Skip to content

Commit

Permalink
fix #5894
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Aug 29, 2012
1 parent 2da8543 commit 7a929f1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/app/main.cpp
Expand Up @@ -264,6 +264,7 @@ int main( int argc, char *argv[] )
// The user can specify a path which will override the default path of custom
// user settings (~/.qgis) and it will be used for QSettings INI file
QString configpath;
QString optionpath;

#if defined(ANDROID)
QgsDebugMsg( QString( "Android: All params stripped" ) );// Param %1" ).arg( argv[0] ) );
Expand Down Expand Up @@ -318,8 +319,7 @@ int main( int argc, char *argv[] )
}
else if ( i + 1 < argc && ( arg == "--optionspath" || arg == "-o" ) )
{
QSettings::setDefaultFormat( QSettings::IniFormat );
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, argv[++i] );
optionpath = argv[++i];
}
else if ( i + 1 < argc && ( arg == "--configpath" || arg == "-c" ) )
{
Expand Down Expand Up @@ -421,8 +421,7 @@ int main( int argc, char *argv[] )
break;

case 'o':
QSettings::setDefaultFormat( QSettings::IniFormat );
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, optarg );
optionspath = optarg;
break;

case 'c':
Expand Down Expand Up @@ -481,11 +480,11 @@ int main( int argc, char *argv[] )
exit( 1 ); //exit for now until a version of qgis is capabable of running non interactive
}

if ( !configpath.isEmpty() )
if ( !optionpath.isEmpty() || !configpath.isEmpty() )
{
// tell QSettings to use INI format and save the file in custom config path
QSettings::setDefaultFormat( QSettings::IniFormat );
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, configpath );
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, optionpath.isEmpty() ? configpath : optionpath );
}

// GUI customization is enabled by default unless --nocustomization argument is used
Expand All @@ -505,6 +504,13 @@ int main( int argc, char *argv[] )
QCoreApplication::setApplicationName( "QGIS" );
QCoreApplication::setAttribute( Qt::AA_DontShowIconsInMenus, false );

if ( !optionpath.isEmpty() || !configpath.isEmpty() )
{
// tell QSettings to use INI format and save the file in custom config path
QSettings::setDefaultFormat( QSettings::IniFormat );
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, optionpath.isEmpty() ? configpath : optionpath );
}

// Load and set possible default customization, must be done afterQgsApplication init and QSettings ( QCoreApplication ) init
QgsCustomization::instance()->loadDefault();

Expand Down
3 changes: 3 additions & 0 deletions src/python/qgspythonutilsimpl.cpp
Expand Up @@ -71,6 +71,9 @@ void QgsPythonUtilsImpl::initPython( QgisInterface* interface )
QStringList pluginpaths;
foreach ( QString p, extraPluginsPaths() )
{
#ifdef Q_OS_WIN
p = p.replace( '\\', "\\\\" );
#endif
pluginpaths << '"' + p + '"';
}
pluginpaths << homePluginsPath();
Expand Down

0 comments on commit 7a929f1

Please sign in to comment.