untested changes so DP might work with this again. Who knows if they even compile.
This commit is contained in:
parent
44bf9ab0e0
commit
a15293c86f
|
|
@ -189,7 +189,22 @@ void VFS_Destroy()
|
||||||
#endif
|
#endif
|
||||||
void HomePaths_Realise()
|
void HomePaths_Realise()
|
||||||
{
|
{
|
||||||
#if defined(POSIX)
|
#if defined(__APPLE__)
|
||||||
|
const char* prefix = g_pGameDescription->getKeyValue("prefix");
|
||||||
|
if(!string_empty(prefix))
|
||||||
|
{
|
||||||
|
StringOutputStream path(256);
|
||||||
|
path << DirectoryCleaned(g_get_home_dir()) << "Library/Application Support" << (prefix+1) << "/";
|
||||||
|
if(!file_is_directory(path.c_str()))
|
||||||
|
{
|
||||||
|
path.clear();
|
||||||
|
path << DirectoryCleaned(g_get_home_dir()) << prefix << "/";
|
||||||
|
}
|
||||||
|
g_qeglobals.m_userEnginePath = path.c_str();
|
||||||
|
Q_mkdir(g_qeglobals.m_userEnginePath.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#elif defined(POSIX)
|
||||||
const char* prefix = g_pGameDescription->getKeyValue("prefix");
|
const char* prefix = g_pGameDescription->getKeyValue("prefix");
|
||||||
if(!string_empty(prefix))
|
if(!string_empty(prefix))
|
||||||
{
|
{
|
||||||
|
|
@ -207,7 +222,7 @@ void HomePaths_Realise()
|
||||||
TCHAR mydocsdir[MAX_PATH + 1];
|
TCHAR mydocsdir[MAX_PATH + 1];
|
||||||
if(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, mydocsdir))
|
if(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, mydocsdir))
|
||||||
{
|
{
|
||||||
path << DirectoryCleaned(mydocsdir) << "My Games/" << prefix << "/";
|
path << DirectoryCleaned(mydocsdir) << "My Games/" << (prefix+1) << "/";
|
||||||
// win32: only add it if it already exists
|
// win32: only add it if it already exists
|
||||||
if(file_is_directory(path.c_str()))
|
if(file_is_directory(path.c_str()))
|
||||||
g_qeglobals.m_userEnginePath = path.c_str();
|
g_qeglobals.m_userEnginePath = path.c_str();
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ several games based on the Quake III Arena engine, in the form of "Q3Map2."
|
||||||
#define MAX_GAME_PATHS 10
|
#define MAX_GAME_PATHS 10
|
||||||
|
|
||||||
char *homePath;
|
char *homePath;
|
||||||
|
qboolean homePathUsesDot;
|
||||||
char installPath[ MAX_OS_PATH ];
|
char installPath[ MAX_OS_PATH ];
|
||||||
|
|
||||||
int numBasePaths;
|
int numBasePaths;
|
||||||
|
|
@ -65,8 +66,9 @@ gets the user's home dir (for ~/.q3a)
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#endif
|
#endif
|
||||||
char *LokiGetHomeDir( void )
|
char *LokiGetHomeDir( qboolean *usedot )
|
||||||
{
|
{
|
||||||
|
*usedot = qtrue;
|
||||||
#ifndef Q_UNIX
|
#ifndef Q_UNIX
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -76,6 +78,7 @@ char *LokiGetHomeDir( void )
|
||||||
if(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, mydocsdir))
|
if(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, mydocsdir))
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%s/My Games", mydocsdir);
|
snprintf(buf, sizeof(buf), "%s/My Games", mydocsdir);
|
||||||
|
*usedot = qfalse;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -104,6 +107,18 @@ char *LokiGetHomeDir( void )
|
||||||
endpwent();
|
endpwent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
{
|
||||||
|
static char foo[MAX_OSPATH];
|
||||||
|
snprintf(foo, sizeof(foo), "%s/Library/Application Support", home);
|
||||||
|
if(access(foo, X_OK) == 0)
|
||||||
|
{
|
||||||
|
*usedot = qfalse;
|
||||||
|
home = foo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* return it */
|
/* return it */
|
||||||
return home;
|
return home;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -125,7 +140,7 @@ void LokiInitPaths( char *argv0 )
|
||||||
strcpy( installPath, "../" );
|
strcpy( installPath, "../" );
|
||||||
|
|
||||||
/* get home dir */
|
/* get home dir */
|
||||||
home = LokiGetHomeDir();
|
home = LokiGetHomeDir(&homePathUsesDot);
|
||||||
if( home == NULL )
|
if( home == NULL )
|
||||||
home = ".";
|
home = ".";
|
||||||
|
|
||||||
|
|
@ -141,7 +156,7 @@ void LokiInitPaths( char *argv0 )
|
||||||
|
|
||||||
|
|
||||||
/* get home dir */
|
/* get home dir */
|
||||||
home = LokiGetHomeDir();
|
home = LokiGetHomeDir(&homePathUsesDot);
|
||||||
if( home == NULL )
|
if( home == NULL )
|
||||||
home = ".";
|
home = ".";
|
||||||
|
|
||||||
|
|
@ -307,7 +322,7 @@ void AddHomeBasePath( char *path )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* concatenate home dir and path */
|
/* concatenate home dir and path */
|
||||||
sprintf( temp, "%s/%s", homePath, path );
|
sprintf( temp, "%s/%s", homePath, homePathUsesDot ? path : (path+1) );
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user