aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs/Config.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/Config.cxx')
-rw-r--r--src/fs/Config.cxx46
1 files changed, 14 insertions, 32 deletions
diff --git a/src/fs/Config.cxx b/src/fs/Config.cxx
index 6aa23005c..0b39a362f 100644
--- a/src/fs/Config.cxx
+++ b/src/fs/Config.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -22,40 +22,22 @@
#include "Charset.hxx"
#include "config/ConfigGlobal.hxx"
-#ifdef WIN32
-#include <windows.h> // for GetACP()
-#include <stdio.h> // for sprintf()
-#elif defined(HAVE_GLIB)
-#include <glib.h>
-#endif
-
-void
-ConfigureFS()
+bool
+ConfigureFS(Error &error)
{
-#if defined(HAVE_GLIB) || defined(WIN32)
- const char *charset = nullptr;
-
- charset = config_get_string(CONF_FS_CHARSET, nullptr);
- if (charset == nullptr) {
-#ifndef WIN32
- const gchar **encodings;
- g_get_filename_charsets(&encodings);
-
- if (encodings[0] != nullptr && *encodings[0] != '\0')
- charset = encodings[0];
+#ifdef HAVE_FS_CHARSET
+ const char *charset = config_get_string(ConfigOption::FS_CHARSET);
+ return charset == nullptr || SetFSCharset(charset, error);
#else
- /* Glib claims that file system encoding is always utf-8
- * on native Win32 (i.e. not Cygwin).
- * However this is true only if <gstdio.h> helpers are used.
- * MPD uses regular <stdio.h> functions.
- * Those functions use encoding determined by GetACP(). */
- static char win_charset[13];
- sprintf(win_charset, "cp%u", GetACP());
- charset = win_charset;
+ (void)error;
+ return true;
#endif
- }
+}
- if (charset != nullptr)
- SetFSCharset(charset);
+void
+DeinitFS()
+{
+#ifdef HAVE_FS_CHARSET
+ DeinitFSCharset();
#endif
}