Attempt to resolve prefix_win32 support on Windows. Support for m_strHomeGame was previously conditionalized for Linux and Mac only. Also, try to fix a few OS-specific path issues by using G_DIR_SEPARATOR.

This commit is contained in:
jdolan 2013-09-13 10:07:17 -04:00
parent e3d0f74cdc
commit 10569d4e0c
2 changed files with 27 additions and 29 deletions

View file

@ -1182,7 +1182,7 @@ void DoProjectSettings(){
str = g_pGameDescription->mBaseGame.GetBuffer(); str = g_pGameDescription->mBaseGame.GetBuffer();
} }
g_qeglobals.m_strHomeMaps += str; g_qeglobals.m_strHomeMaps += str;
g_qeglobals.m_strHomeMaps += '/'; g_qeglobals.m_strHomeMaps += G_DIR_SEPARATOR;
// RIANT // RIANT
// SOF2 HACK // SOF2 HACK

View file

@ -620,7 +620,7 @@ bool QE_LoadProject( const char *projectfile ){
str = g_pGameDescription->mBaseGame.GetBuffer(); str = g_pGameDescription->mBaseGame.GetBuffer();
} }
g_qeglobals.m_strHomeMaps += str; g_qeglobals.m_strHomeMaps += str;
g_qeglobals.m_strHomeMaps += '/'; g_qeglobals.m_strHomeMaps += G_DIR_SEPARATOR;
// don't forget to create the dirs // don't forget to create the dirs
Q_mkdir( g_qeglobals.m_strHomeGame.GetBuffer(), 0775 ); Q_mkdir( g_qeglobals.m_strHomeGame.GetBuffer(), 0775 );
@ -656,7 +656,7 @@ bool QE_LoadProject( const char *projectfile ){
// create the writable project file path // create the writable project file path
strcpy( buf, g_qeglobals.m_strHomeGame.GetBuffer() ); strcpy( buf, g_qeglobals.m_strHomeGame.GetBuffer() );
strcat( buf, g_pGameDescription->mBaseGame.GetBuffer() ); strcat( buf, g_pGameDescription->mBaseGame.GetBuffer() );
strcat( buf, "/scripts/" ); strcat( buf, G_DIR_SEPARATOR_S "scripts" G_DIR_SEPARATOR_S );
// while the filename is already in use, increment the number we add to the end // while the filename is already in use, increment the number we add to the end
int counter = 0; int counter = 0;
char pUser[PATH_MAX]; char pUser[PATH_MAX];
@ -844,23 +844,22 @@ void QE_InitVFS( void ){
// if we have a mod dir // if we have a mod dir
if ( *ValueForKey( g_qeglobals.d_project_entity, "gamename" ) != '\0' ) { if ( *ValueForKey( g_qeglobals.d_project_entity, "gamename" ) != '\0' ) {
#if defined ( __linux__ ) || defined ( __APPLE__ )
// ~/.<gameprefix>/<fs_game> // ~/.<gameprefix>/<fs_game>
directory = g_qeglobals.m_strHomeGame.GetBuffer(); if ( g_qeglobals.m_strHomeGame.GetLength() ) {
Q_mkdir( directory.GetBuffer(), 0775 ); directory = g_qeglobals.m_strHomeGame.GetBuffer();
directory += ValueForKey( g_qeglobals.d_project_entity, "gamename" ); Q_mkdir( directory.GetBuffer(), 0775 );
Q_mkdir( directory.GetBuffer(), 0775 ); directory += ValueForKey( g_qeglobals.d_project_entity, "gamename" );
vfsInitDirectory( directory.GetBuffer() ); Q_mkdir( directory.GetBuffer(), 0775 );
AddSlash( directory ); vfsInitDirectory( directory.GetBuffer() );
prefabs = directory; AddSlash( directory );
// also create the maps dir, it will be used as prompt for load/save prefabs = directory;
directory += "/maps"; // also create the maps dir, it will be used as prompt for load/save
Q_mkdir( directory, 0775 ); directory += "maps";
// and the prefabs dir Q_mkdir( directory, 0775 );
prefabs += "/prefabs"; // and the prefabs dir
Q_mkdir( prefabs, 0775 ); prefabs += "prefabs";
Q_mkdir( prefabs, 0775 );
#endif }
// <fs_basepath>/<fs_game> // <fs_basepath>/<fs_game>
directory = g_pGameDescription->mEnginePath; directory = g_pGameDescription->mEnginePath;
@ -870,19 +869,19 @@ void QE_InitVFS( void ){
AddSlash( directory ); AddSlash( directory );
prefabs = directory; prefabs = directory;
// also create the maps dir, it will be used as prompt for load/save // also create the maps dir, it will be used as prompt for load/save
directory += "/maps"; directory += "maps";
Q_mkdir( directory.GetBuffer(), 0775 ); Q_mkdir( directory.GetBuffer(), 0775 );
// and the prefabs dir // and the prefabs dir
prefabs += "/prefabs"; prefabs += "prefabs";
Q_mkdir( prefabs, 0775 ); Q_mkdir( prefabs, 0775 );
} }
#if defined ( __linux__ ) || defined ( __APPLE__ )
// ~/.<gameprefix>/<fs_main> // ~/.<gameprefix>/<fs_main>
directory = g_qeglobals.m_strHomeGame.GetBuffer(); if ( g_qeglobals.m_strHomeGame.GetLength() ) {
directory += g_pGameDescription->mBaseGame; directory = g_qeglobals.m_strHomeGame.GetBuffer();
vfsInitDirectory( directory.GetBuffer() ); directory += g_pGameDescription->mBaseGame;
#endif vfsInitDirectory( directory.GetBuffer() );
}
// <fs_basepath>/<fs_main> // <fs_basepath>/<fs_main>
directory = g_pGameDescription->mEnginePath; directory = g_pGameDescription->mEnginePath;
@ -1617,9 +1616,8 @@ void FillBSPMenu(){
void AddSlash( CString& strPath ){ void AddSlash( CString& strPath ){
if ( strPath.GetLength() > 0 ) { if ( strPath.GetLength() > 0 ) {
if ( ( strPath.GetAt( strPath.GetLength() - 1 ) != '/' ) && if ( !g_str_has_suffix( strPath.GetBuffer(), G_DIR_SEPARATOR_S ) ) {
( strPath.GetAt( strPath.GetLength() - 1 ) != '\\' ) ) { strPath += G_DIR_SEPARATOR_S;
strPath += '/';
} }
} }
} }