aboutsummaryrefslogtreecommitdiffstats
path: root/src/CommandLine.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/CommandLine.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx
index e87b1676f..1a55a29ea 100644
--- a/src/CommandLine.cxx
+++ b/src/CommandLine.cxx
@@ -35,6 +35,7 @@
#include "fs/Traits.hxx"
#include "fs/FileSystem.hxx"
#include "fs/StandardDirectory.hxx"
+#include "util/Macros.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "util/OptionDef.hxx"
@@ -337,7 +338,19 @@ parse_cmdline(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) {
+ error.SetLastError("MultiByteToWideChar() failed");
+ return false;
+ }
+
+ return ReadConfigFile(Path::FromFS(buffer), error);
+#else
return ReadConfigFile(Path::FromFS(config_file), error);
+#endif
}
/* use default configuration file path */