aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 7d28b976..ae55e9b4 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -918,7 +918,22 @@ static void alc_initconfig(void)
str = getenv("ALSOFT_LOGFILE");
if(str && str[0])
{
- FILE *logfile = al_fopen(str, "wt");
+#ifdef _WIN32
+ FILE *logfile = NULL;
+ int len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
+ if(len > 0)
+ {
+ WCHAR *wname = calloc(sizeof(WCHAR), len);
+ if(wname)
+ {
+ MultiByteToWideChar(CP_UTF8, 0, str, -1, wname, len);
+ logfile = _wfopen(wname, L"wt");
+ free(wname);
+ }
+ }
+#else
+ FILE *logfile = fopen(str, "wt");
+#endif
if(logfile) LogFile = logfile;
else ERR("Failed to open log file '%s'\n", str);
}