Allow overriding documents home with an env var

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7543
This commit is contained in:
Jon Evans 2021-02-16 20:44:42 -05:00
parent 114043fe93
commit 13a91dd49d
1 changed files with 8 additions and 2 deletions

View File

@ -37,7 +37,13 @@
void PATHS::getUserDocumentPath( wxFileName& aPath )
{
aPath.AssignDir( KIPLATFORM::ENV::GetDocumentsPath() );
wxString envPath;
if( wxGetEnv( wxT( "KICAD_DOCUMENTS_HOME" ), &envPath ) )
aPath.AssignDir( envPath );
else
aPath.AssignDir( KIPLATFORM::ENV::GetDocumentsPath() );
aPath.AppendDir( KICAD_PATH_STR );
aPath.AppendDir( SETTINGS_MANAGER::GetSettingsVersion() );
}
@ -232,4 +238,4 @@ void PATHS::EnsureUserPathsExist()
EnsurePathExists( GetDefaultUserSymbolsPath() );
EnsurePathExists( GetDefaultUserFootprintsPath() );
EnsurePathExists( GetDefaultUser3DModelsPath() );
}
}