diff options
-rw-r--r-- | src/ConfigPath.cxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ConfigPath.cxx b/src/ConfigPath.cxx index 6bc56b897..85739761c 100644 --- a/src/ConfigPath.cxx +++ b/src/ConfigPath.cxx @@ -82,10 +82,6 @@ ParsePath(const char *path, Error &error) { assert(path != nullptr); - Path path2 = Path::FromUTF8(path, error); - if (path2.IsNull()) - return Path::Null(); - #ifndef WIN32 if (path[0] == '~') { Path home = Path::Null(); @@ -105,12 +101,19 @@ ParsePath(const char *path, Error &error) home = GetHome(user, error); g_free(user); - path = slash; + if (slash == nullptr) + return home; + + path = slash + 1; } if (home.IsNull()) return Path::Null(); + Path path2 = Path::FromUTF8(path, error); + if (path2.IsNull()) + return Path::Null(); + return Path::Build(home, path2); } else if (!g_path_is_absolute(path)) { error.Format(path_domain, @@ -118,7 +121,7 @@ ParsePath(const char *path, Error &error) return Path::Null(); } else { #endif - return path2; + return Path::FromUTF8(path, error); #ifndef WIN32 } #endif |