diff options
author | 2021-08-26 15:48:15 +1000 | |
---|---|---|
committer | 2021-08-26 15:48:15 +1000 | |
commit | bdbf452e91a80598026bfc7671c0b5339676f237 (patch) | |
tree | 436a98700dc11b5922eb2c161cc9ab6deb5890d3 | |
parent | 2e9297ee05f40b0ab31ef5b89a424b5f8c758a53 (diff) |
util/zippath.cpp: OSD_WINDOWS isn't a safe way to detect Windows target, and OSD_* macros must not be used outside libocore/libosd.
-rw-r--r-- | src/lib/util/zippath.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/util/zippath.cpp b/src/lib/util/zippath.cpp index 023484010b8..7e8e804ad42 100644 --- a/src/lib/util/zippath.cpp +++ b/src/lib/util/zippath.cpp @@ -48,7 +48,9 @@ int is_path_separator(char c) bool is_root(std::string_view path) { -#if defined(OSD_WINDOWS) +#if defined(WIN32) + // FIXME: don't assume paths are DOS-like - UNC paths, \\?\ long path prefix, etc. complicate this + // skip drive letter if (path.length() >= 2 && isalpha(path[0]) && (path[1] == ':')) path.remove_prefix(2); @@ -56,6 +58,7 @@ bool is_root(std::string_view path) // skip path separators return path.find_first_not_of(PATH_SEPARATOR) == std::string_view::npos; #else + // FIXME: handle multiple successive path separators, current directory references, parent directory references return (path.length() == 1) && (path[0] == '/'); #endif } |