pcsx2: Create GetProgramDataDir (for cheats_ws and game db)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5851 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2014-01-27 18:59:52 +00:00
parent 48356e31b8
commit 61da62bf27
5 changed files with 17 additions and 29 deletions

View File

@ -150,7 +150,6 @@ endif(EXISTS "${PROJECT_SOURCE_DIR}/plugins")
if(PACKAGE_MODE)
INSTALL(FILES "${PROJECT_SOURCE_DIR}/bin/cheats_ws.zip" DESTINATION "${GAMEINDEX_DIR}")
INSTALL(FILES "${PROJECT_SOURCE_DIR}/bin/GameIndex.dbf" DESTINATION "${GAMEINDEX_DIR}")
INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/bin/cheats" DESTINATION "${GAMEINDEX_DIR}")
INSTALL(FILES "${PROJECT_SOURCE_DIR}/linux_various/pcsx2.desktop" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications")
INSTALL(FILES "${PROJECT_SOURCE_DIR}/linux_various/pcsx2.xpm" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/pixmaps")

View File

@ -158,6 +158,19 @@ namespace PathDefs
return GetDocuments( DocsFolderMode );
}
wxDirName GetProgramDataDir()
{
#ifndef GAMEINDEX_DIR_COMPILATION
return AppRoot();
#else
// Each linux distributions have his rules for path so we give them the possibility to
// change it with compilation flags. -- Gregory
#define xGAMEINDEX_str(s) GAMEINDEX_DIR_str(s)
#define GAMEINDEX_DIR_str(s) #s
return wxDirName( xGAMEINDEX_str(GAMEINDEX_DIR_COMPILATION) );
#endif
}
wxDirName GetSnapshots()
{
return GetDocuments() + Base::Snapshots();
@ -170,15 +183,7 @@ namespace PathDefs
wxDirName GetCheats()
{
// Each linux distributions have his rules for path so we give them the possibility to
// change it with compilation flags. -- Gregory
#ifndef GAMEINDEX_DIR_COMPILATION
return AppRoot() + wxDirName( L"cheats" );
#else
#define xGAMEINDEX_str(s) GAMEINDEX_DIR_str(s)
#define GAMEINDEX_DIR_str(s) #s
return wxDirName( xGAMEINDEX_str(GAMEINDEX_DIR_COMPILATION) ) + wxDirName( L"cheats" );
#endif
}
wxDirName GetCheatsWS()

View File

@ -43,6 +43,7 @@ namespace PathDefs
// used otherwise, in favor of the user-configurable specifications in the ini files.
extern wxDirName GetUserLocalDataDir();
extern wxDirName GetProgramDataDir();
extern wxDirName GetDocuments();
extern wxDirName GetDocuments( DocsModeType mode );
extern wxDirName GetThemes();

View File

@ -375,15 +375,7 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
gameWsHacks.Printf(L" [%d widescreen hacks]", numberLoadedWideScreenPatches);
} else {
// No ws cheat files found at the cheats_ws folder, try the ws cheats zip file.
#ifndef GAMEINDEX_DIR_COMPILATION
wxString cheats_ws_archive = Path::Combine(((wxFileName)wxStandardPaths::Get().GetExecutablePath()).GetPath(), L"cheats_ws.zip");
#else
// Each linux distributions have his rules for path so we give them the possibility to
// change it with compilation flags. -- Gregory
#define xGAMEINDEX_str(s) GAMEINDEX_DIR_str(s)
#define GAMEINDEX_DIR_str(s) #s
wxString cheats_ws_archive = Path::Combine(xGAMEINDEX_str(GAMEINDEX_DIR_COMPILATION), L"cheats_ws.zip");
#endif
wxString cheats_ws_archive = Path::Combine(PathDefs::GetProgramDataDir(), wxFileName(L"cheats_ws.zip"));
if (numberDbfCheatsLoaded = LoadCheatsFromZip(gameCRC, cheats_ws_archive)) {
Console.WriteLn(Color_Green, "(Wide Screen Cheats DB) Patches Loaded: %d", numberDbfCheatsLoaded);

View File

@ -51,17 +51,8 @@ public:
Console.WriteLn( "(GameDB) Unloading..." );
}
// Each linux distributions have his rules for path so we give them the possibility to
// change it with compilation flags. -- Gregory
#ifndef GAMEINDEX_DIR_COMPILATION
AppGameDatabase& LoadFromFile(const wxString& file = L"GameIndex.dbf", const wxString& key = L"Serial" );
void SaveToFile(const wxString& file = L"GameIndex.dbf");
#else
#define xGAMEINDEX_str(s) GAMEINDEX_DIR_str(s)
#define GAMEINDEX_DIR_str(s) #s
AppGameDatabase& LoadFromFile(const wxString& file = Path::Combine( wxString(xGAMEINDEX_str(GAMEINDEX_DIR_COMPILATION), wxConvUTF8) , L"GameIndex.dbf" ), const wxString& key = L"Serial" );
void SaveToFile(const wxString& file = Path::Combine( wxString(xGAMEINDEX_str(GAMEINDEX_DIR_COMPILATION), wxConvUTF8) , L"GameIndex.dbf") );
#endif
AppGameDatabase& LoadFromFile(const wxString& file = Path::Combine( PathDefs::GetProgramDataDir(), wxFileName(L"GameIndex.dbf") ), const wxString& key = L"Serial" );
void SaveToFile(const wxString& file = Path::Combine( PathDefs::GetProgramDataDir(), wxFileName(L"GameIndex.dbf")) );
};
static wxString compatToStringWX(int compat) {