summaryrefslogtreecommitdiff
path: root/src/CommandLine.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2020-04-02 16:18:06 +0200
committerMax Kellermann <max@musicpd.org>2020-04-02 17:15:34 +0200
commit4d453a8313c1eab29880666f3e34164c4e73d35c (patch)
tree48d493d0b8a752f80a1cf06b1ceffbff4d9de8f8 /src/CommandLine.cxx
parent61d7b436a29d492610fbc6d60928427f1533dfbe (diff)
fs/NarrowPath: add class FromNarrowPath
Move code from ParseCommandLine().
Diffstat (limited to 'src/CommandLine.cxx')
-rw-r--r--src/CommandLine.cxx14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx
index 5ede49580..93396bc0b 100644
--- a/src/CommandLine.cxx
+++ b/src/CommandLine.cxx
@@ -33,11 +33,11 @@
#include "playlist/PlaylistRegistry.hxx"
#include "playlist/PlaylistPlugin.hxx"
#include "fs/AllocatedPath.hxx"
+#include "fs/NarrowPath.hxx"
#include "fs/Traits.hxx"
#include "fs/FileSystem.hxx"
#include "fs/StandardDirectory.hxx"
#include "system/Error.hxx"
-#include "util/Macros.hxx"
#include "util/RuntimeError.hxx"
#include "util/Domain.hxx"
#include "util/OptionDef.hxx"
@@ -380,17 +380,7 @@ ParseCommandLine(int argc, char **argv, struct options &options,
if (config_file != nullptr) {
/* use specified configuration file */
-#ifdef _UNICODE
- wchar_t buffer[MAX_PATH];
- auto result = MultiByteToWideChar(CP_ACP, 0, config_file, -1,
- buffer, ARRAY_SIZE(buffer));
- if (result <= 0)
- throw MakeLastError("MultiByteToWideChar() failed");
-
- ReadConfigFile(config, Path::FromFS(buffer));
-#else
- ReadConfigFile(config, Path::FromFS(config_file));
-#endif
+ ReadConfigFile(config, FromNarrowPath(config_file));
return;
}