diff options
Diffstat (limited to 'src/configreader.cpp')
| -rw-r--r-- | src/configreader.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index 804406ec4..d49878baa 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -71,14 +71,22 @@ std::string ServerConfig::ServerPaths::ExpandPath(const std::string& base, const if (std::filesystem::path(fragment).is_absolute()) return fragment; - // The fragment is relative to a home directory, expand that. if (!fragment.compare(0, 2, "~/", 2)) { + // The fragment is relative to a home directory, expand that. const char* homedir = getenv("HOME"); if (homedir && *homedir) return std::string(homedir) + '/' + fragment.substr(2); } + if (std::filesystem::path(base).is_relative()) + { + // The base is relative to the working directory, expand that. + const auto cwd = std::filesystem::current_path(); + if (!cwd.empty()) + return INSP_FORMAT("{}/{}/{}", cwd.string(), base, fragment); + } + return base + '/' + fragment; } |
