diff --git a/headers/private/storage/EntryOperationEngineBase.h b/headers/private/storage/EntryOperationEngineBase.h index 0c64d3217d..bcdee29e1c 100644 --- a/headers/private/storage/EntryOperationEngineBase.h +++ b/headers/private/storage/EntryOperationEngineBase.h @@ -17,6 +17,7 @@ class BEntry; class BPath; struct entry_ref; +struct node_ref; namespace BPrivate { @@ -35,6 +36,8 @@ public: const char* path = NULL); Entry(const BEntry& entry); Entry(const entry_ref& entryRef); + Entry(const node_ref& directoryRef, + const char* path = NULL); ~Entry(); status_t GetPath(BPath& buffer, const char*& _path) @@ -46,6 +49,7 @@ private: const char* fPath; const BEntry* fEntry; const entry_ref* fEntryRef; + const node_ref* fDirectoryRef; }; diff --git a/src/kits/storage/EntryOperationEngineBase.cpp b/src/kits/storage/EntryOperationEngineBase.cpp index e03c0d8def..cf22cd90c6 100644 --- a/src/kits/storage/EntryOperationEngineBase.cpp +++ b/src/kits/storage/EntryOperationEngineBase.cpp @@ -19,18 +19,20 @@ BEntryOperationEngineBase::Entry::Entry(const char* path) fDirectory(NULL), fPath(path), fEntry(NULL), - fEntryRef(NULL) - + fEntryRef(NULL), + fDirectoryRef(NULL) { } -BEntryOperationEngineBase::Entry::Entry(const BDirectory& directory, const char* path) +BEntryOperationEngineBase::Entry::Entry(const BDirectory& directory, + const char* path) : fDirectory(&directory), fPath(path), fEntry(NULL), - fEntryRef(NULL) + fEntryRef(NULL), + fDirectoryRef(NULL) { } @@ -40,7 +42,8 @@ BEntryOperationEngineBase::Entry::Entry(const BEntry& entry) fDirectory(NULL), fPath(NULL), fEntry(&entry), - fEntryRef(NULL) + fEntryRef(NULL), + fDirectoryRef(NULL) { } @@ -50,7 +53,20 @@ BEntryOperationEngineBase::Entry::Entry(const entry_ref& entryRef) fDirectory(NULL), fPath(NULL), fEntry(NULL), - fEntryRef(&entryRef) + fEntryRef(&entryRef), + fDirectoryRef(NULL) +{ +} + + +BEntryOperationEngineBase::Entry::Entry(const node_ref& directoryRef, + const char* path) + : + fDirectory(NULL), + fPath(path), + fEntry(NULL), + fEntryRef(NULL), + fDirectoryRef(&directoryRef) { } @@ -72,6 +88,11 @@ BEntryOperationEngineBase::Entry::GetPath(BPath& buffer, const char*& _path) error = buffer.SetTo(fDirectory, fPath); } else if (fEntryRef != NULL) { error = buffer.SetTo(fEntryRef); + } else if (fDirectoryRef != NULL) { + BDirectory directory; + error = directory.SetTo(fDirectoryRef); + if (error == B_OK) + error = buffer.SetTo(&directory, fPath); } else if (fPath != NULL) { _path = fPath; return B_OK;