aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-10 04:27:10 -0800
committerChris Robinson <[email protected]>2018-11-10 04:27:10 -0800
commitdc31969b04395db71d8162587f55cf81e7e69aac (patch)
tree7c4d07e655dc4fb4f6b19b477207b196799ce649 /Alc/ALc.c
parent58eb0e754d19237ca66d705834081a236e307484 (diff)
Get rid of the last few al_fopen calls
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);
}