diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-01-22 02:54:29 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-02-04 03:33:22 -0500 |
| commit | 2a0e78e3cf0c1106a1fb7e470148f6e0b093b2b1 (patch) | |
| tree | aa0ce69d111a22d232dc1589fa707855bddc53b0 /src/shared | |
| parent | 6005da618775d545c664371f53571a75eacab7f2 (diff) | |
fixed bad path for alternate origins
finished ShellMenuCollection, had to split a bunch of things
Diffstat (limited to 'src/shared')
| -rw-r--r-- | src/shared/directoryentry.cpp | 14 | ||||
| -rw-r--r-- | src/shared/directoryentry.h | 7 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp index 460431a4..4181098c 100644 --- a/src/shared/directoryentry.cpp +++ b/src/shared/directoryentry.cpp @@ -354,12 +354,20 @@ bool FileEntry::isFromArchive(std::wstring archiveName) const return false;
}
-std::wstring FileEntry::getFullPath() const
+std::wstring FileEntry::getFullPath(int originID) const
{
- bool ignore = false;
+ if (originID == -1) {
+ bool ignore = false;
+ originID = getOrigin(ignore);
+ }
// base directory for origin
- std::wstring result = m_Parent->getOriginByID(getOrigin(ignore)).getPath();
+ const auto* o = m_Parent->findOriginByID(originID);
+ if (!o) {
+ return {};
+ }
+
+ std::wstring result = o->getPath();
// all intermediate directories
recurseParents(result, m_Parent);
diff --git a/src/shared/directoryentry.h b/src/shared/directoryentry.h index 69eb7574..6102c88f 100644 --- a/src/shared/directoryentry.h +++ b/src/shared/directoryentry.h @@ -127,7 +127,12 @@ public: }
bool isFromArchive(std::wstring archiveName = L"") const;
- std::wstring getFullPath() const;
+
+ // if originID is -1, uses the main origin; if this file doesn't exist in the
+ // given origin, returns an empty string
+ //
+ std::wstring getFullPath(int originID=-1) const;
+
std::wstring getRelativePath() const;
DirectoryEntry *getParent()
|
