mirror of
https://github.com/blendogames/thirtyflightsofloving.git
synced 2024-11-15 00:41:21 +00:00
Added working directory fix from R1Q2.
This commit is contained in:
parent
e96adb36a9
commit
2788421eb0
2 changed files with 39 additions and 2 deletions
|
@ -2311,7 +2311,6 @@ void FS_InitFilesystem (void)
|
|||
// basedir <path>
|
||||
// allows the game to run from outside the data tree
|
||||
fs_basedir = Cvar_Get ("basedir", ".", CVAR_NOSET);
|
||||
// fs_basedir = Cvar_Get ("basedir", (char *)Sys_ExeDir(), CVAR_NOSET);
|
||||
|
||||
// cddir <path>
|
||||
// Logically concatenates the cddir after the basedir for
|
||||
|
|
|
@ -1683,7 +1683,7 @@ Init_ExeDir
|
|||
*/
|
||||
static void Init_ExeDir (void)
|
||||
{
|
||||
#if 0
|
||||
#if 1
|
||||
memset(exe_dir, 0, sizeof(exe_dir));
|
||||
Q_snprintfz (exe_dir, sizeof(exe_dir), ".");
|
||||
#else
|
||||
|
@ -1711,6 +1711,41 @@ static void Init_ExeDir (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
FixWorkingDirectory
|
||||
==================
|
||||
*/
|
||||
void FixWorkingDirectory (void)
|
||||
{
|
||||
int i;
|
||||
char *p;
|
||||
char curDir[MAX_PATH];
|
||||
|
||||
GetModuleFileName (NULL, curDir, sizeof(curDir)-1);
|
||||
|
||||
p = strrchr (curDir, '\\');
|
||||
p[0] = 0;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (!strcmp (argv[i], "-nopathcheck"))
|
||||
goto skipPathCheck;
|
||||
|
||||
if (!strcmp (argv[i], "-nocwdcheck"))
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen(curDir) > (MAX_OSPATH - MAX_QPATH))
|
||||
Sys_Error ("Current path is too long. Please move your Quake II installation to a shorter path.");
|
||||
|
||||
skipPathCheck:
|
||||
|
||||
SetCurrentDirectory (curDir);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
Detect_WinNT5orLater
|
||||
|
@ -1844,6 +1879,9 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
|
||||
Sys_SetHighDPIMode (); // setup DPI awareness
|
||||
|
||||
// r1ch: always change to our directory (ugh)
|
||||
FixWorkingDirectory ();
|
||||
|
||||
Init_ExeDir (); // Knightmare added
|
||||
|
||||
#ifndef NEW_DED_CONSOLE
|
||||
|
|
Loading…
Reference in a new issue