diff options
-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 c99673d22..f367b128c 100644 --- a/src/fileutils.cpp +++ b/src/fileutils.cpp @@ -76,6 +76,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; } |