Handle lack of a Documents directory

This commit is contained in:
Jon Evans 2021-02-09 20:12:38 -05:00
parent 048050c980
commit 1ba7bebce6
1 changed files with 4 additions and 0 deletions

View File

@ -61,6 +61,10 @@ wxString KIPLATFORM::ENV::GetDocumentsPath()
fallback.AppendDir( "Documents" );
fallback.MakeAbsolute();
// No Documents dir and nothing from XDG? Give up and use $HOME
if( !fallback.DirExists() || !fallback.IsDirWritable() )
fallback.RemoveLastDir();
docsPath = fallback.GetFullPath();
}