diff options
| author | 2020-05-19 20:35:00 +0100 | |
|---|---|---|
| committer | 2020-05-19 20:37:32 +0100 | |
| commit | a721aaf90f480675d225ed80c9b9e1c9fbe51ec0 (patch) | |
| tree | 7c523a3df722ea372bef2d3c0d30d01ceeb5c3f7 /src/fileutils.cpp | |
| parent | Replace FileSystem::GetFileList with std::filesystem. (diff) | |
| parent | Fix CallInit overriding the error from dlopen. (diff) | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src/fileutils.cpp')
| -rw-r--r-- | src/fileutils.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fileutils.cpp b/src/fileutils.cpp index 58c2019cc..c9f547c30 100644 --- a/src/fileutils.cpp +++ b/src/fileutils.cpp @@ -74,6 +74,14 @@ std::string FileSystem::ExpandPath(const std::string& base, const std::string& f if (fragment[0] == '/' || FileSystem::StartsWithWindowsDriveLetter(fragment)) return fragment; + // The fragment is relative to a home directory, expand that. + if (!fragment.compare(0, 2, "~/", 2)) + { + const char* homedir = getenv("HOME"); + if (homedir && *homedir) + return std::string(homedir) + '/' + fragment.substr(2); + } + return base + '/' + fragment; } |
