summaryrefslogtreecommitdiff
path: root/src/sys/sys_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/sys_unix.c')
-rw-r--r--src/sys/sys_unix.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/sys/sys_unix.c b/src/sys/sys_unix.c
index 3360469d..60623a27 100644
--- a/src/sys/sys_unix.c
+++ b/src/sys/sys_unix.c
@@ -55,22 +55,11 @@ char *Sys_DefaultHomePath(void)
{
Q_strncpyz( homePath, p, sizeof( homePath ) );
#ifdef MACOS_X
- Q_strcat( homePath, sizeof( homePath ), "/Library" );
- mkdir( homePath, 0750 );
- Q_strcat( homePath, sizeof( homePath ), "/Application Support" );
- mkdir( homePath, 0750 );
- Q_strcat( homePath, sizeof( homePath ), "/Tremulous" );
+ Q_strcat( homePath, sizeof( homePath ),
+ "/Library/Application Support/Tremulous" );
#else
Q_strcat( homePath, sizeof( homePath ), "/.tremulous" );
#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
==================
*/
-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;
}
/*
@@ -583,3 +577,19 @@ void Sys_PlatformInit( void )
signal( SIGIOT, Sys_SigHandler );
signal( SIGBUS, Sys_SigHandler );
}
+
+/*
+==============
+Sys_SetEnv
+
+set/unset environment variables (empty value removes it)
+==============
+*/
+
+void Sys_SetEnv(const char *name, const char *value)
+{
+ if(value && *value)
+ setenv(name, value, 1);
+ else
+ unsetenv(name);
+}