Skip to content

Commit

Permalink
look for qgis_global_settings.ini also in the AppDataLocation (fix #3…
Browse files Browse the repository at this point in the history
…1288)

Allow to put global settings file in the default location managed by the
user or system administrator which is not touched by installer and does
not require any additional setup like passing commandline parameters or
settings environment variable.
  • Loading branch information
alexbruy committed Apr 23, 2020
1 parent 4f91bee commit 8681826
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/main.cpp
Expand Up @@ -896,12 +896,22 @@ int main( int argc, char *argv[] )
// Set up the QgsSettings Global Settings:
// - use the path specified with --globalsettingsfile path,
// - use the environment if not found
// - use the AppDataLocation ($HOME/.local/share/QGIS/QGIS3 on Linux, roaming path on Windows)
// - use a default location as a fallback
if ( globalsettingsfile.isEmpty() )
{
globalsettingsfile = getenv( "QGIS_GLOBAL_SETTINGS_FILE" );
}

if ( globalsettingsfile.isEmpty() )
{
QStringList startupPaths = QStandardPaths::locateAll( QStandardPaths::AppDataLocation, QStringLiteral( "qgis_global_settings.ini" ) );
if ( !startupPaths.isEmpty() )
{
globalsettingsfile = startupPaths.at( 0 );
}
}

if ( globalsettingsfile.isEmpty() )
{
QString default_globalsettingsfile = QgsApplication::resolvePkgPath() + "/resources/qgis_global_settings.ini";
Expand Down

0 comments on commit 8681826

Please sign in to comment.