#endif
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");
if(!string_empty(prefix))
{
TCHAR mydocsdir[MAX_PATH + 1];
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
if(file_is_directory(path.c_str()))
g_qeglobals.m_userEnginePath = path.c_str();
#define MAX_GAME_PATHS 10
char *homePath;
+qboolean homePathUsesDot;
char installPath[ MAX_OS_PATH ];
int numBasePaths;
#ifdef WIN32
#include <shlobj.h>
#endif
-char *LokiGetHomeDir( void )
+char *LokiGetHomeDir( qboolean *usedot )
{
+ *usedot = qtrue;
#ifndef Q_UNIX
#ifndef WIN32
return NULL;
if(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, mydocsdir))
{
snprintf(buf, sizeof(buf), "%s/My Games", mydocsdir);
+ *usedot = qfalse;
return buf;
}
return NULL;
}
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 home;
strcpy( installPath, "../" );
/* get home dir */
- home = LokiGetHomeDir();
+ home = LokiGetHomeDir(&homePathUsesDot);
if( home == NULL )
home = ".";
-
+
/* set home path */
homePath = home;
#else
/* get home dir */
- home = LokiGetHomeDir();
+ home = LokiGetHomeDir(&homePathUsesDot);
if( home == NULL )
home = ".";
return;
/* concatenate home dir and path */
- sprintf( temp, "%s/%s", homePath, path );
+ sprintf( temp, "%s/%s", homePath, homePathUsesDot ? path : (path+1) );
#ifdef WIN32
{