From dc31969b04395db71d8162587f55cf81e7e69aac Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 10 Nov 2018 04:27:10 -0800 Subject: Get rid of the last few al_fopen calls --- Alc/ALc.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'Alc/ALc.c') 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); } -- cgit v1.2.3