mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:03:23 +00:00
core/windows.c: write logs to the user path
Writing logs to the path where the executable is located, might not be possible if the current user doesn't have permissions to write there. Obtain the user path and write the log files to the user path instead - e.g.: c:\users\myuser\appdata\roaming\subsurface\subsurface_*.log Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
c47b6b672f
commit
6af67f541d
1 changed files with 8 additions and 2 deletions
|
@ -424,8 +424,14 @@ void subsurface_console_init(void)
|
|||
console_desc.err = freopen("CON", "w", stderr);
|
||||
} else {
|
||||
verbose = 1; /* set the verbose level to '1' */
|
||||
console_desc.out = freopen("subsurface_out.log", "w", stdout);
|
||||
console_desc.err = freopen("subsurface_err.log", "w", stderr);
|
||||
wchar_t *wpath_out = system_default_path_append(L"subsurface_out.log");
|
||||
wchar_t *wpath_err = system_default_path_append(L"subsurface_err.log");
|
||||
if (wpath_out && wpath_err) {
|
||||
console_desc.out = _wfreopen(wpath_out, L"w", stdout);
|
||||
console_desc.err = _wfreopen(wpath_err, L"w", stderr);
|
||||
}
|
||||
free((void *)wpath_out);
|
||||
free((void *)wpath_err);
|
||||
}
|
||||
|
||||
puts(""); /* add an empty line */
|
||||
|
|
Loading…
Add table
Reference in a new issue