aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-02-28 22:07:01 +0100
committerMax Kellermann <max@duempel.org>2015-02-28 23:00:27 +0100
commit44b9197354dc1f69c6de6a2f4f3e5a5722d05b62 (patch)
tree95bdfddd8c2bb791be738803dcbd8989e9acfdfd /src
parent7a8f96b1dd707ef96f8d8fe6821263d6f3cd225b (diff)
downloadmpd-44b9197354dc1f69c6de6a2f4f3e5a5722d05b62.tar.gz
mpd-44b9197354dc1f69c6de6a2f4f3e5a5722d05b62.tar.xz
mpd-44b9197354dc1f69c6de6a2f4f3e5a5722d05b62.zip
Mapper: use class Path
Diffstat (limited to '')
-rw-r--r--src/Mapper.cxx4
-rw-r--r--src/Mapper.hxx3
-rw-r--r--src/PlaylistFile.cxx8
3 files changed, 10 insertions, 5 deletions
diff --git a/src/Mapper.cxx b/src/Mapper.cxx
index 1dff3949c..14718ca09 100644
--- a/src/Mapper.cxx
+++ b/src/Mapper.cxx
@@ -86,8 +86,10 @@ map_uri_fs(const char *uri)
}
std::string
-map_fs_to_utf8(const char *path_fs)
+map_fs_to_utf8(Path _path_fs)
{
+ auto path_fs = _path_fs.c_str();
+
if (PathTraitsFS::IsSeparator(path_fs[0])) {
if (instance->storage == nullptr)
return std::string();
diff --git a/src/Mapper.hxx b/src/Mapper.hxx
index 95bd81a49..ac07079f0 100644
--- a/src/Mapper.hxx
+++ b/src/Mapper.hxx
@@ -30,6 +30,7 @@
#define PLAYLIST_FILE_SUFFIX ".m3u"
+class Path;
class AllocatedPath;
void
@@ -58,7 +59,7 @@ map_uri_fs(const char *uri);
*/
gcc_pure
std::string
-map_fs_to_utf8(const char *path_fs);
+map_fs_to_utf8(Path path_fs);
#endif
diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx
index 4c2f8d22e..804f7d951 100644
--- a/src/PlaylistFile.cxx
+++ b/src/PlaylistFile.cxx
@@ -268,13 +268,15 @@ LoadPlaylistFile(const char *utf8path, Error &error)
if (*s == 0 || *s == PLAYLIST_COMMENT)
continue;
+ const Path path = Path::FromFS(s);
+
std::string uri_utf8;
if (!uri_has_scheme(s)) {
#ifdef ENABLE_DATABASE
- uri_utf8 = map_fs_to_utf8(s);
+ uri_utf8 = map_fs_to_utf8(path);
if (uri_utf8.empty()) {
- if (PathTraitsFS::IsAbsolute(s)) {
+ if (path.IsAbsolute()) {
uri_utf8 = PathToUTF8(s);
if (uri_utf8.empty())
continue;
@@ -287,7 +289,7 @@ LoadPlaylistFile(const char *utf8path, Error &error)
continue;
#endif
} else {
- uri_utf8 = PathToUTF8(s);
+ uri_utf8 = path.ToUTF8();
if (uri_utf8.empty())
continue;
}