Get rid of the prefix game definition and path nonsense

This commit is contained in:
Marco Cawthorne 2021-06-05 14:30:03 +02:00
parent 806a6fd08c
commit 13aa866ef3
4 changed files with 3 additions and 82 deletions

View File

@ -332,7 +332,8 @@ void streams_init()
void paths_init()
{
g_strSettingsPath = environment_get_home_path();
//g_strSettingsPath = environment_get_home_path();
g_strSettingsPath = environment_get_app_path();
Q_mkdir(g_strSettingsPath.c_str());

View File

@ -204,72 +204,7 @@ static qSHGetKnownFolderPath_t *qSHGetKnownFolderPath;
void HomePaths_Realise()
{
do {
const char *prefix = g_pGameDescription->getKeyValue("prefix");
if (!string_empty(prefix)) {
StringOutputStream path(256);
#if GDEF_OS_MACOS
path.clear();
path << DirectoryCleaned( g_get_home_dir() ) << "Library/Application Support" << ( prefix + 1 ) << "/";
if ( file_is_directory( path.c_str() ) ) {
g_qeglobals.m_userEnginePath = path.c_str();
break;
}
path.clear();
path << DirectoryCleaned( g_get_home_dir() ) << prefix << "/";
#endif
#if GDEF_OS_WINDOWS
TCHAR mydocsdir[MAX_PATH + 1];
wchar_t *mydocsdirw;
HMODULE shfolder = LoadLibrary( "shfolder.dll" );
if ( shfolder ) {
qSHGetKnownFolderPath = (qSHGetKnownFolderPath_t *) GetProcAddress( shfolder, "SHGetKnownFolderPath" );
}
else{
qSHGetKnownFolderPath = NULL;
}
CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
if ( qSHGetKnownFolderPath && qSHGetKnownFolderPath( qFOLDERID_SavedGames, qKF_FLAG_CREATE | qKF_FLAG_NO_ALIAS, NULL, &mydocsdirw ) == S_OK ) {
memset( mydocsdir, 0, sizeof( mydocsdir ) );
wcstombs( mydocsdir, mydocsdirw, sizeof( mydocsdir ) - 1 );
CoTaskMemFree( mydocsdirw );
path.clear();
path << DirectoryCleaned( mydocsdir ) << ( prefix + 1 ) << "/";
if ( file_is_directory( path.c_str() ) ) {
g_qeglobals.m_userEnginePath = path.c_str();
CoUninitialize();
FreeLibrary( shfolder );
break;
}
}
CoUninitialize();
if ( shfolder ) {
FreeLibrary( shfolder );
}
if ( SHGetFolderPath( NULL, CSIDL_PERSONAL, NULL, 0, mydocsdir ) ) {
path.clear();
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();
break;
}
}
#endif
#if GDEF_OS_POSIX
path.clear();
path << DirectoryCleaned(g_get_home_dir()) << prefix << "/";
g_qeglobals.m_userEnginePath = path.c_str();
break;
#endif
}
g_qeglobals.m_userEnginePath = EnginePath_get();
} while (0);
g_qeglobals.m_userEnginePath = EnginePath_get();
Q_mkdir(g_qeglobals.m_userEnginePath.c_str());
{

View File

@ -86,13 +86,6 @@ void QE_InitVFS()
// if we have a mod dir
if (!string_equal(gamename, basegame)) {
// ~/.<gameprefix>/<fs_game>
if (userRoot && !g_disableHomePath) {
StringOutputStream userGamePath(256);
userGamePath << userRoot << gamename << '/';
GlobalFileSystem().initDirectory(userGamePath.c_str());
}
// <fs_basepath>/<fs_game>
if (!g_disableEnginePath) {
StringOutputStream globalGamePath(256);
@ -101,13 +94,6 @@ void QE_InitVFS()
}
}
// ~/.<gameprefix>/<fs_main>
if (userRoot && !g_disableHomePath) {
StringOutputStream userBasePath(256);
userBasePath << userRoot << basegame << '/';
GlobalFileSystem().initDirectory(userBasePath.c_str());
}
// <fs_basepath>/<fs_main>
if (!g_disableEnginePath) {
StringOutputStream globalBasePath(256);

View File

@ -9,7 +9,6 @@
engine_win32="nuclide.bat"
engine_linux="nuclide"
engine_macos="Nuclide.app"
prefix=".tw"
basegame="platform"
basegamename="Nuclide"
unknowngamename="Game dir"