Commit 77e163e5 authored by Max Kellermann's avatar Max Kellermann

Mapper: use Path::IsAbsolute()

parent 0e00b900
...@@ -86,11 +86,9 @@ map_uri_fs(const char *uri) ...@@ -86,11 +86,9 @@ map_uri_fs(const char *uri)
} }
std::string std::string
map_fs_to_utf8(Path _path_fs) map_fs_to_utf8(Path path_fs)
{ {
auto path_fs = _path_fs.c_str(); if (path_fs.IsAbsolute()) {
if (PathTraitsFS::IsSeparator(path_fs[0])) {
if (instance->storage == nullptr) if (instance->storage == nullptr)
return std::string(); return std::string();
...@@ -98,12 +96,14 @@ map_fs_to_utf8(Path _path_fs) ...@@ -98,12 +96,14 @@ map_fs_to_utf8(Path _path_fs)
if (music_dir_fs.IsNull()) if (music_dir_fs.IsNull())
return std::string(); return std::string();
path_fs = music_dir_fs.Relative(_path_fs); auto relative = music_dir_fs.Relative(path_fs);
if (path_fs == nullptr || *path_fs == 0) if (relative == nullptr || *relative == 0)
return std::string(); return std::string();
path_fs = Path::FromFS(relative);
} }
return PathToUTF8(path_fs); return path_fs.ToUTF8();
} }
#endif #endif
......
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