mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-09 23:01:55 +00:00
issue #687 - putting the game install folders under XDG_DATA_HOME
This commit is contained in:
parent
2b6ee83552
commit
db3c56505e
4 changed files with 17 additions and 6 deletions
|
@ -466,6 +466,8 @@ int mainRadiant( int argc, char* argv[] ) {
|
|||
QE_ConvertDOSToUnixName( pBuffer, pBuffer );
|
||||
g_strAppPath.ReleaseBuffer();
|
||||
|
||||
g_strGamePath = g_strAppPath;
|
||||
|
||||
g_strBitmapsPath = g_strAppPath;
|
||||
g_strBitmapsPath += "bitmaps/";
|
||||
|
||||
|
@ -513,6 +515,16 @@ int mainRadiant( int argc, char* argv[] ) {
|
|||
loki_init_datapath( argv[0] );
|
||||
g_strAppPath = loki_get_datapath();
|
||||
|
||||
const char *xdg_data_home = getenv( "XDG_DATA_HOME" );
|
||||
if ( xdg_data_home != nullptr ) {
|
||||
g_strGamesPath = xdg_data_home;
|
||||
g_strGamesPath += "/";
|
||||
} else {
|
||||
g_strGamesPath = g_strAppPath;
|
||||
}
|
||||
g_strGamesPath += "games/";
|
||||
Q_mkdir( g_strGamesPath.GetBuffer(), 0775 );
|
||||
|
||||
// radiant is installed in the parent dir of "tools/"
|
||||
// NOTE: this is not very easy for debugging
|
||||
// maybe add options to lookup in several places?
|
||||
|
|
|
@ -45,7 +45,8 @@
|
|||
#endif
|
||||
|
||||
// globals
|
||||
CString g_strAppPath; ///< holds the full path of the executable - readonly! (in flatpak at least)
|
||||
CString g_strAppPath; ///< holds the full path of the executable - readonly in flatpak
|
||||
CString g_strGamesPath; ///< installed/configured games 'work area'
|
||||
CString g_strDTDPath; ///< path to the DTD files
|
||||
CString g_pidFile; ///< the global .pid file (only for global part of the startup)
|
||||
CString g_pidGameFile; ///< the game-specific .pid file
|
||||
|
|
|
@ -1193,9 +1193,7 @@ void CGameDialog::ScanForGames(){
|
|||
CString strPath;
|
||||
char *dirlist;
|
||||
GDir *dir;
|
||||
CString strGamesPath = g_strAppPath.GetBuffer();
|
||||
strGamesPath += "games";
|
||||
const char *path = strGamesPath.GetBuffer();
|
||||
const char *path = g_strGamesPath.GetBuffer();
|
||||
|
||||
if ( !mGames.empty() ) {
|
||||
Sys_Printf( "Clearing game list\n" );
|
||||
|
@ -3582,8 +3580,7 @@ void CGameInstall::Run() {
|
|||
Sys_Printf( "combo: %d name: %s engine: %s mod: %s\n", m_nComboSelect, m_strName.GetBuffer(), m_strEngine.GetBuffer(), m_strMod.GetBuffer() );
|
||||
|
||||
// Resolve the game pack and .game file
|
||||
Str gamePack, gameFilePath = g_strAppPath.GetBuffer();
|
||||
gameFilePath += "games/";
|
||||
Str gamePack, gameFilePath = g_strGamesPath.GetBuffer();
|
||||
if ( CheckFile( gameFilePath ) != PATH_DIRECTORY ) {
|
||||
radCreateDirectory( gameFilePath );
|
||||
}
|
||||
|
|
|
@ -761,6 +761,7 @@ class ClipPoint;
|
|||
|
||||
extern MainFrame* g_pParentWnd;
|
||||
extern CString g_strAppPath;
|
||||
extern CString g_strGamesPath;
|
||||
extern CString g_strDTDPath;
|
||||
extern CString g_pidFile;
|
||||
extern CString g_pidGameFile;
|
||||
|
|
Loading…
Reference in a new issue