diff --git a/src/backends/unix/system.c b/src/backends/unix/system.c index d3b31e26..8627515d 100644 --- a/src/backends/unix/system.c +++ b/src/backends/unix/system.c @@ -550,3 +550,12 @@ Sys_FreeLibrary(void *handle) } } +/* + * Just a dummy. There's no need on unixoid systems to + * redirect stdout and stderr. + */ +void +Sys_RedirectStdout(void) +{ + return; +} diff --git a/src/backends/windows/system.c b/src/backends/windows/system.c index 3d710047..f2198879 100644 --- a/src/backends/windows/system.c +++ b/src/backends/windows/system.c @@ -652,7 +652,7 @@ Sys_RedirectStdout(void) char path_stdout[MAX_OSPATH]; char path_stderr[MAX_OSPATH]; - if (dedicated && dedicated->value) + if (portable->value) { return; } @@ -708,11 +708,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, /* Make the current instance global */ global_hInstance = hInstance; - /* Redirect stdout and stderr into a file */ -#ifndef DEDICATED_ONLY - Sys_RedirectStdout(); -#endif - printf("Yamagi Quake II v%s\n", YQ2VERSION); printf("=====================\n\n"); diff --git a/src/client/cl_keyboard.c b/src/client/cl_keyboard.c index 4e1b4f2f..a4f0b0e7 100644 --- a/src/client/cl_keyboard.c +++ b/src/client/cl_keyboard.c @@ -786,7 +786,7 @@ Key_WriteConsoleHistory() int i; char path[MAX_OSPATH]; - if (fs_portable->value) + if (portable->value) { Com_sprintf(path, sizeof(path), "%sconsole_history.txt", Sys_GetBinaryDir()); } @@ -833,7 +833,7 @@ Key_ReadConsoleHistory() char path[MAX_OSPATH]; - if (fs_portable->value) + if (portable->value) { Com_sprintf(path, sizeof(path), "%sconsole_history.txt", Sys_GetBinaryDir()); } diff --git a/src/common/filesystem.c b/src/common/filesystem.c index 5617800d..89833cdd 100644 --- a/src/common/filesystem.c +++ b/src/common/filesystem.c @@ -131,7 +131,6 @@ cvar_t *fs_basedir; cvar_t *fs_cddir; cvar_t *fs_gamedirvar; cvar_t *fs_debug; -cvar_t *fs_portable; fsHandle_t *FS_GetFileByHandle(fileHandle_t f); char *Sys_GetCurrentDirectory(void); @@ -943,7 +942,7 @@ FS_AddHomeAsGameDirectory(char *dir) char gdir[MAX_OSPATH]; size_t len; - if (fs_portable->value) + if (portable->value) { return; } @@ -1572,9 +1571,6 @@ FS_InitFilesystem(void) /* Current directory. */ fs_homepath = Cvar_Get("homepath", Sys_GetCurrentDirectory(), CVAR_NOSET); - /* Be portable, don't add HOME to the search patch */ - fs_portable = Cvar_Get("fs_portable", "0", 0); - /* Add baseq2 to search path. */ FS_AddGameDirectory(va("%s/" BASEDIRNAME, fs_basedir->string)); FS_AddBinaryDirAsGameDirectory(BASEDIRNAME); diff --git a/src/common/header/common.h b/src/common/header/common.h index c5c733d6..822efb67 100644 --- a/src/common/header/common.h +++ b/src/common/header/common.h @@ -726,7 +726,7 @@ extern cvar_t *modder; extern cvar_t *dedicated; extern cvar_t *host_speeds; extern cvar_t *log_stats; -extern cvar_t *fs_portable; +extern cvar_t *portable; extern FILE *log_stats_file; @@ -769,6 +769,7 @@ void Sys_Sleep(int msec); void Sys_FreeLibrary(void *handle); void *Sys_LoadLibrary(const char *path, const char *sym, void **handle); void *Sys_GetProcAddress(void *handle, const char *sym); +void Sys_RedirectStdout(void); /* CLIENT / SERVER SYSTEMS */ diff --git a/src/common/misc.c b/src/common/misc.c index 73d56ee8..060743f3 100644 --- a/src/common/misc.c +++ b/src/common/misc.c @@ -35,6 +35,8 @@ cvar_t *developer; cvar_t *modder; cvar_t *timescale; cvar_t *fixedtime; +cvar_t *portable; + #ifndef DEDICATED_ONLY cvar_t *showtrace; #endif @@ -200,7 +202,12 @@ Qcommon_Init(int argc, char **argv) Cmd_Init(); Cvar_Init(); + /* Be portable, don't add HOME to the search path + * This is needed by Sys_RedirectStdout() on Windows*/ + portable = Cvar_Get("portable", "0", 0); + #ifndef DEDICATED_ONLY + Sys_RedirectStdout(); Key_Init(); #endif