Commit 1c65908c authored by Max Kellermann's avatar Max Kellermann

ConfigPath: simplify the duplicate tilde check

parent 3aaf013d
...@@ -87,11 +87,7 @@ ParsePath(const char *path, Error &error) ...@@ -87,11 +87,7 @@ ParsePath(const char *path, Error &error)
return Path::Null(); return Path::Null();
#ifndef WIN32 #ifndef WIN32
if (!g_path_is_absolute(path) && path[0] != '~') { if (path[0] == '~') {
error.Format(path_domain,
"not an absolute path: %s", path);
return Path::Null();
} else if (path[0] == '~') {
Path home = Path::Null(); Path home = Path::Null();
if (path[1] == '/' || path[1] == '\0') { if (path[1] == '/' || path[1] == '\0') {
...@@ -116,6 +112,10 @@ ParsePath(const char *path, Error &error) ...@@ -116,6 +112,10 @@ ParsePath(const char *path, Error &error)
return Path::Null(); return Path::Null();
return Path::Build(home, path2); return Path::Build(home, path2);
} else if (!g_path_is_absolute(path)) {
error.Format(path_domain,
"not an absolute path: %s", path);
return Path::Null();
} else { } else {
#endif #endif
return path2; return path2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment