Skip to content

Commit

Permalink
A bit more RAII
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Apr 9, 2018
1 parent 3a5e96a commit 10db1c8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/app/main.cpp
Expand Up @@ -830,17 +830,16 @@ int main( int argc, char *argv[] )
}
}

QSettings *globalSettings = new QSettings( globalsettingsfile, QSettings::IniFormat );
globalSettings->setIniCodec( "UTF-8" );
if ( configLocalStorageLocation.isEmpty() )
{
QSettings globalSettings( globalsettingsfile, QSettings::IniFormat );
if ( getenv( "QGIS_CUSTOM_CONFIG_PATH" ) )
{
configLocalStorageLocation = getenv( "QGIS_CUSTOM_CONFIG_PATH" );
}
else if ( globalSettings->contains( QStringLiteral( "core/profilesPath" ) ) )
else if ( globalSettings.contains( QStringLiteral( "core/profilesPath" ) ) )
{
configLocalStorageLocation = globalSettings->value( QStringLiteral( "core/profilesPath" ), "" ).toString();
configLocalStorageLocation = globalSettings.value( QStringLiteral( "core/profilesPath" ), "" ).toString();
QgsDebugMsg( QString( "Loading profiles path from global config at %1" ).arg( configLocalStorageLocation ) );
}

Expand All @@ -850,7 +849,6 @@ int main( int argc, char *argv[] )
configLocalStorageLocation = QStandardPaths::standardLocations( QStandardPaths::AppDataLocation ).value( 0 );
}
}
delete globalSettings;

QString rootProfileFolder = QgsUserProfileManager::resolveProfilesFolder( configLocalStorageLocation );
QgsUserProfileManager manager( rootProfileFolder );
Expand Down

0 comments on commit 10db1c8

Please sign in to comment.