mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 06:20:48 +00:00
Create homedir before redirecting stdout and stderr
This commit is contained in:
parent
403c69d6c1
commit
b96d247db3
1 changed files with 17 additions and 0 deletions
|
@ -695,7 +695,9 @@ Sys_GetHomeDir(void)
|
|||
void
|
||||
Sys_RedirectStdout(void)
|
||||
{
|
||||
char *cur;
|
||||
char *home;
|
||||
char *old;
|
||||
char path_stdout[MAX_OSPATH];
|
||||
char path_stderr[MAX_OSPATH];
|
||||
|
||||
|
@ -711,6 +713,21 @@ Sys_RedirectStdout(void)
|
|||
return;
|
||||
}
|
||||
|
||||
cur = old = home;
|
||||
|
||||
while (cur != NULL)
|
||||
{
|
||||
if ((cur - old) > 1)
|
||||
{
|
||||
*cur = '\0';
|
||||
Sys_Mkdir(home);
|
||||
*cur = '/';
|
||||
}
|
||||
|
||||
old = cur;
|
||||
cur = strchr(old + 1, '/');
|
||||
}
|
||||
|
||||
snprintf(path_stdout, sizeof(path_stdout), "%s/%s", home, "stdout.txt");
|
||||
snprintf(path_stderr, sizeof(path_stderr), "%s/%s", home, "stderr.txt");
|
||||
|
||||
|
|
Loading…
Reference in a new issue