[pcsx2]: use a local implementation of GetUserLocalDataDir. Follow the xdg specification for linux.

IMPORTANT NOTE FOR LINUX USER: the "main" pcsx2 configuration is moved from $HOME/.pcsx2 to $XDG_CONFIG_HOME/pcsx2 (or $HOME/.config/pcsx2 if xdg var is not defined).
A first time wizard is expected. Just import you previous settings.

[cmake]: add a missing h file. 


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3336 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2010-06-28 19:46:54 +00:00
parent 1c7fc3e176
commit 0a012aec25
4 changed files with 30 additions and 3 deletions

View File

@ -94,6 +94,31 @@ namespace PathDefs
return retval; return retval;
} }
// Specifies the main configuration folder.
wxDirName GetUserLocalDataDir()
{
#ifdef __LINUX__
// Note: GetUserLocalDataDir() on linux return $HOME/.pcsx2 unfortunately it does not follow the XDG standard
// So we re-implement it, to follow the standard.
wxDirName user_local_dir;
wxString xdg_home_value;
if( wxGetEnv(L"XDG_CONFIG_HOME", &xdg_home_value) ) {
if ( xdg_home_value.IsEmpty() ) {
// variable exist but it is empty. So use the default value
user_local_dir = (wxDirName)Path::Combine( wxStandardPaths::Get().GetUserConfigDir() , wxDirName( L".config/pcsx2" ));
} else {
user_local_dir = (wxDirName)Path::Combine( xdg_home_value, pxGetAppName());
}
} else {
// variable do not exist
user_local_dir = (wxDirName)Path::Combine( wxStandardPaths::Get().GetUserConfigDir() , wxDirName( L".config/pcsx2" ));
}
return user_local_dir;
#else
return wxDirName(wxStandardPaths::Get().GetUserLocalDataDir());
#endif
}
// Fetches the path location for user-consumable documents -- stuff users are likely to want to // Fetches the path location for user-consumable documents -- stuff users are likely to want to
// share with other programs: screenshots, memory cards, and savestates. // share with other programs: screenshots, memory cards, and savestates.
wxDirName GetDocuments( DocsModeType mode ) wxDirName GetDocuments( DocsModeType mode )

View File

@ -36,6 +36,7 @@ namespace PathDefs
// complete pathnames are returned by these functions // complete pathnames are returned by these functions
// For 99% of all code, you should use these. // For 99% of all code, you should use these.
extern wxDirName GetUserLocalDataDir();
extern wxDirName GetDocuments(); extern wxDirName GetDocuments();
extern wxDirName GetDocuments( DocsModeType mode ); extern wxDirName GetDocuments( DocsModeType mode );
extern wxDirName GetThemes(); extern wxDirName GetThemes();

View File

@ -57,7 +57,7 @@ static void CpuCheckSSE2()
void Pcsx2App::WipeUserModeSettings() void Pcsx2App::WipeUserModeSettings()
{ {
wxDirName usrlocaldir( wxStandardPaths::Get().GetUserLocalDataDir() ); wxDirName usrlocaldir = PathDefs::GetUserLocalDataDir();
if( !usrlocaldir.Exists() ) return; if( !usrlocaldir.Exists() ) return;
wxString cwd( Path::Normalize( wxGetCwd() ) ); wxString cwd( Path::Normalize( wxGetCwd() ) );
@ -86,7 +86,7 @@ void Pcsx2App::WipeUserModeSettings()
// //
void Pcsx2App::ReadUserModeSettings() void Pcsx2App::ReadUserModeSettings()
{ {
wxDirName usrlocaldir( wxStandardPaths::Get().GetUserLocalDataDir() ); wxDirName usrlocaldir = PathDefs::GetUserLocalDataDir();
if( !usrlocaldir.Exists() ) if( !usrlocaldir.Exists() )
{ {
Console.WriteLn( L"Creating UserLocalData folder: " + usrlocaldir.ToString() ); Console.WriteLn( L"Creating UserLocalData folder: " + usrlocaldir.ToString() );

View File

@ -103,7 +103,8 @@ set(zzoglHeaders
x86.h x86.h
zerogs.h zerogs.h
zerogsmath.h zerogsmath.h
zpipe.h) zpipe.h
ZZoglCRTC.h)
# zzogl S sources # zzogl S sources
set(zzoglSSources set(zzoglSSources