@@ -92,6 +92,7 @@ void usage( std::string const & appName )
9292 << " \t [--project projectfile]\t load the given QGIS project\n "
9393 << " \t [--extent xmin,ymin,xmax,ymax]\t set initial map extent\n "
9494 << " \t [--nologo]\t hide splash screen\n "
95+ << " \t [--optionspath path]\t use the given QSettings path\n "
9596 << " \t [--help]\t\t this text\n\n "
9697 << " FILES:\n "
9798 << " Files specified on the command line can include rasters,\n "
@@ -303,13 +304,14 @@ int main( int argc, char *argv[] )
303304 {" lang" , required_argument, 0 , ' l' },
304305 {" project" , required_argument, 0 , ' p' },
305306 {" extent" , required_argument, 0 , ' e' },
307+ {" optionspath" , required_argument, 0 , ' o' },
306308 {0 , 0 , 0 , 0 }
307309 };
308310
309311 /* getopt_long stores the option index here. */
310312 int option_index = 0 ;
311313
312- optionChar = getopt_long ( argc, argv, " swhlpe " ,
314+ optionChar = getopt_long ( argc, argv, " swhlpeo " ,
313315 long_options, &option_index );
314316
315317 /* Detect the end of the options. */
@@ -356,6 +358,10 @@ int main( int argc, char *argv[] )
356358 myInitialExtent = optarg;
357359 break ;
358360
361+ case ' o' :
362+ QSettings::setPath ( QSettings::NativeFormat, QSettings::UserScope, optarg );
363+ break ;
364+
359365 case ' ?' :
360366 usage ( argv[0 ] );
361367 return 2 ; // XXX need standard exit codes
@@ -420,6 +426,10 @@ int main( int argc, char *argv[] )
420426 {
421427 myInitialExtent = argv[++i];
422428 }
429+ else if ( i + 1 < argc && ( arg == " --optionspath" || arg == " -o" ) )
430+ {
431+ QSettings::setPath ( QSettings::NativeFormat, QSettings::UserScope, argv[++i] );
432+ }
423433 else
424434 {
425435 myFileList.append ( QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( argv[i] ) ).absoluteFilePath () ) );
0 commit comments