* Reimplement r1597-1598 in a better way (Oopss)
* Fix Sys_SetEnv warning
This commit is contained in:
parent
e8f5d5055d
commit
eee9770fbf
4 changed files with 24 additions and 27 deletions
|
@ -492,7 +492,10 @@ qboolean FS_CreatePath (char *OSPath) {
|
||||||
if (*ofs == PATH_SEP) {
|
if (*ofs == PATH_SEP) {
|
||||||
// create the directory
|
// create the directory
|
||||||
*ofs = 0;
|
*ofs = 0;
|
||||||
Sys_Mkdir (OSPath);
|
if (!Sys_Mkdir (OSPath)) {
|
||||||
|
Com_Error( ERR_FATAL, "FS_CreatePath: failed to create path \"%s\"\n",
|
||||||
|
OSPath );
|
||||||
|
}
|
||||||
*ofs = PATH_SEP;
|
*ofs = PATH_SEP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2807,6 +2810,7 @@ static void FS_Startup( const char *gameName )
|
||||||
|
|
||||||
// NOTE: same filtering below for mods and basegame
|
// NOTE: same filtering below for mods and basegame
|
||||||
if (fs_homepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
|
if (fs_homepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
|
||||||
|
FS_CreatePath ( fs_homepath->string );
|
||||||
FS_AddGameDirectory ( fs_homepath->string, gameName );
|
FS_AddGameDirectory ( fs_homepath->string, gameName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1071,7 +1071,7 @@ qboolean Sys_StringToAdr( const char *s, netadr_t *a, netadrtype_t family );
|
||||||
qboolean Sys_IsLANAddress (netadr_t adr);
|
qboolean Sys_IsLANAddress (netadr_t adr);
|
||||||
void Sys_ShowIP(void);
|
void Sys_ShowIP(void);
|
||||||
|
|
||||||
void Sys_Mkdir( const char *path );
|
qboolean Sys_Mkdir( const char *path );
|
||||||
char *Sys_Cwd( void );
|
char *Sys_Cwd( void );
|
||||||
void Sys_SetDefaultInstallPath(const char *path);
|
void Sys_SetDefaultInstallPath(const char *path);
|
||||||
char *Sys_DefaultInstallPath(void);
|
char *Sys_DefaultInstallPath(void);
|
||||||
|
@ -1092,6 +1092,8 @@ void Sys_Sleep(int msec);
|
||||||
|
|
||||||
qboolean Sys_LowPhysicalMemory( void );
|
qboolean Sys_LowPhysicalMemory( void );
|
||||||
|
|
||||||
|
void Sys_SetEnv(const char *name, const char *value);
|
||||||
|
|
||||||
/* This is based on the Adaptive Huffman algorithm described in Sayood's Data
|
/* This is based on the Adaptive Huffman algorithm described in Sayood's Data
|
||||||
* Compression book. The ranks are not actually stored, but implicitly defined
|
* Compression book. The ranks are not actually stored, but implicitly defined
|
||||||
* by the location of a node within a doubly-linked list */
|
* by the location of a node within a doubly-linked list */
|
||||||
|
|
|
@ -55,22 +55,11 @@ char *Sys_DefaultHomePath(void)
|
||||||
{
|
{
|
||||||
Q_strncpyz( homePath, p, sizeof( homePath ) );
|
Q_strncpyz( homePath, p, sizeof( homePath ) );
|
||||||
#ifdef MACOS_X
|
#ifdef MACOS_X
|
||||||
Q_strcat( homePath, sizeof( homePath ), "/Library" );
|
Q_strcat( homePath, sizeof( homePath ),
|
||||||
mkdir( homePath, 0750 ); /* just in case. */
|
"/Library/Application Support/Quake3" );
|
||||||
Q_strcat( homePath, sizeof( homePath ), "/Application Support" );
|
|
||||||
mkdir( homePath, 0750 ); /* just in case. */
|
|
||||||
Q_strcat( homePath, sizeof( homePath ), "/Quake3" );
|
|
||||||
#else
|
#else
|
||||||
Q_strcat( homePath, sizeof( homePath ), "/.q3a" );
|
Q_strcat( homePath, sizeof( homePath ), "/.q3a" );
|
||||||
#endif
|
#endif
|
||||||
if( mkdir( homePath, 0750 ) )
|
|
||||||
{
|
|
||||||
if( errno != EEXIST )
|
|
||||||
{
|
|
||||||
Sys_Error( "Unable to create directory \"%s\", error is %s(%d)\n",
|
|
||||||
homePath, strerror( errno ), errno );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,9 +211,14 @@ const char *Sys_Dirname( char *path )
|
||||||
Sys_Mkdir
|
Sys_Mkdir
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void Sys_Mkdir( const char *path )
|
qboolean Sys_Mkdir( const char *path )
|
||||||
{
|
{
|
||||||
mkdir( path, 0777 );
|
int result = mkdir( path, 0750 );
|
||||||
|
|
||||||
|
if( result != 0 )
|
||||||
|
return errno == EEXIST;
|
||||||
|
|
||||||
|
return qtrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -77,14 +77,6 @@ char *Sys_DefaultHomePath( void )
|
||||||
Q_strncpyz( homePath, szPath, sizeof( homePath ) );
|
Q_strncpyz( homePath, szPath, sizeof( homePath ) );
|
||||||
Q_strcat( homePath, sizeof( homePath ), "\\Quake3" );
|
Q_strcat( homePath, sizeof( homePath ), "\\Quake3" );
|
||||||
FreeLibrary(shfolder);
|
FreeLibrary(shfolder);
|
||||||
if( !CreateDirectory( homePath, NULL ) )
|
|
||||||
{
|
|
||||||
if( GetLastError() != ERROR_ALREADY_EXISTS )
|
|
||||||
{
|
|
||||||
Com_Printf("Unable to create directory \"%s\"\n", homePath );
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return homePath;
|
return homePath;
|
||||||
|
@ -279,9 +271,14 @@ const char *Sys_Dirname( char *path )
|
||||||
Sys_Mkdir
|
Sys_Mkdir
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void Sys_Mkdir( const char *path )
|
qboolean Sys_Mkdir( const char *path )
|
||||||
{
|
{
|
||||||
_mkdir (path);
|
int result = _mkdir( path );
|
||||||
|
|
||||||
|
if( result != 0 )
|
||||||
|
return errno == EEXIST;
|
||||||
|
|
||||||
|
return qtrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue