Change Linux documents path to XDG_DATA_HOME
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7543
This commit is contained in:
parent
b2a4cbedda
commit
079203c345
|
@ -51,20 +51,17 @@ bool KIPLATFORM::ENV::IsNetworkPath( const wxString& aPath )
|
||||||
|
|
||||||
wxString KIPLATFORM::ENV::GetDocumentsPath()
|
wxString KIPLATFORM::ENV::GetDocumentsPath()
|
||||||
{
|
{
|
||||||
wxString docsPath = g_get_user_special_dir( G_USER_DIRECTORY_DOCUMENTS );
|
wxString docsPath = g_get_user_data_dir();
|
||||||
|
|
||||||
if( docsPath.IsEmpty() )
|
if( docsPath.IsEmpty() )
|
||||||
{
|
{
|
||||||
wxFileName fallback;
|
wxFileName fallback;
|
||||||
|
|
||||||
fallback.AssignDir( g_get_home_dir() );
|
fallback.AssignDir( g_get_home_dir() );
|
||||||
fallback.AppendDir( "Documents" );
|
fallback.AppendDir( ".local" );
|
||||||
|
fallback.AppendDir( "share" );
|
||||||
fallback.MakeAbsolute();
|
fallback.MakeAbsolute();
|
||||||
|
|
||||||
// No Documents dir and nothing from XDG? Give up and use $HOME
|
|
||||||
if( !fallback.DirExists() || !fallback.IsDirWritable() )
|
|
||||||
fallback.RemoveLastDir();
|
|
||||||
|
|
||||||
docsPath = fallback.GetFullPath();
|
docsPath = fallback.GetFullPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue