summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-03-21 21:32:23 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-03-21 21:32:23 +0000
commit4c1eb9225d5a741e1234d48eb38a8df3da908259 (patch)
tree28d8821623d6f9cce26f316e18342f2c08250785 /src/path.c
parentb72f591641e9d311e813fb8e2ece643cc6562e56 (diff)
add aac_decode.[ch] and start working on it
also, if locale is C or POSIX, set fs charset to iso-8859-1 git-svn-id: https://svn.musicpd.org/mpd/trunk@347 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/path.c')
-rw-r--r--src/path.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/path.c b/src/path.c
index 5a73baa86..e209b671d 100644
--- a/src/path.c
+++ b/src/path.c
@@ -87,40 +87,52 @@ char * getFsCharset() {
}
void initPaths() {
-#ifdef HAVE_LOCALE
-#ifdef HAVE_LANGINFO
- char * originalLocale;
-#endif
-#endif
char * charset = NULL;
+ char * originalLocale;
if(getConf()[CONF_FS_CHARSET]) {
charset = strdup(getConf()[CONF_FS_CHARSET]);
}
#ifdef HAVE_LOCALE
#ifdef HAVE_LANGINFO
- else if((originalLocale = setlocale(LC_CTYPE,""))) {
+ else if((originalLocale = setlocale(LC_CTYPE,NULL))) {
char * temp;
+ char * currentLocale;
+ originalLocale = strdup(originalLocale);
- if((temp = nl_langinfo(CODESET))) {
- charset = strdup(temp);
+ if(!(currentLocale = setlocale(LC_CTYPE,""))) {
+ ERROR("problems setting current locale with "
+ "setlocale()\n");
}
- else ERROR("problems getting charset for locale\n");
- if(!setlocale(LC_CTYPE,originalLocale)) {
- ERROR("problems resetting locale with setlocale()\n");
+ else {
+ if(strcmp(currentLocale,"C")==0 ||
+ strcmp(currentLocale,"POSIX")==0)
+ {
+ ERROR("current locale is \"%s\"\n",
+ currentLocale);
+ }
+ else if((temp = nl_langinfo(CODESET))) {
+ charset = strdup(temp);
+ }
+ else ERROR("problems getting charset for locale\n");
+ if(!setlocale(LC_CTYPE,originalLocale)) {
+ ERROR("problems resetting locale with setlocale()\n");
+ }
}
+
+ free(originalLocale);
}
+ else ERROR("problems getting locale with setlocale()\n");
#endif
#endif
- else ERROR("problems getting locale with setlocale()\n");
if(charset) {
setFsCharset(charset);
free(charset);
}
else {
- ERROR("setting filesystem charset to UTF-8\n");
- setFsCharset("UTF-8");
+ ERROR("setting filesystem charset to ISO-8859-1\n");
+ setFsCharset("ISO-8859-1");
}
}