summaryrefslogtreecommitdiff
path: root/src/PlaylistFile.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-02-25 16:01:46 +0100
committerMax Kellermann <max@duempel.org>2015-03-05 10:15:10 +0100
commit65ff72cdf8d3fc8664893b55ca47fca284f34d87 (patch)
tree766eca97378aa4567d7e55aba24c4a785f956f9d /src/PlaylistFile.cxx
parent1da09563310a666095e93d3b4fdc5556a8a7c534 (diff)
fs/Traits: enable _UNICODE on Windows
Use wchar_t for everything on Windows. Solves a lot of filesystem charset problems.
Diffstat (limited to 'src/PlaylistFile.cxx')
-rw-r--r--src/PlaylistFile.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx
index 791b2f2ed..1123f00ba 100644
--- a/src/PlaylistFile.cxx
+++ b/src/PlaylistFile.cxx
@@ -268,7 +268,17 @@ LoadPlaylistFile(const char *utf8path, Error &error)
if (*s == 0 || *s == PLAYLIST_COMMENT)
continue;
+#ifdef _UNICODE
+ wchar_t buffer[MAX_PATH];
+ auto result = MultiByteToWideChar(CP_ACP, 0, s, -1,
+ buffer, ARRAY_SIZE(buffer));
+ if (result <= 0)
+ continue;
+
+ const Path path = Path::FromFS(buffer);
+#else
const Path path = Path::FromFS(s);
+#endif
std::string uri_utf8;