Skip to content

Commit c5452ac

Browse files
author
mhugent
committed
Add option to set QSettings path
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13045 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent ab9e926 commit c5452ac

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/app/main.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ void usage( std::string const & appName )
9292
<< "\t[--project projectfile]\tload the given QGIS project\n"
9393
<< "\t[--extent xmin,ymin,xmax,ymax]\tset initial map extent\n"
9494
<< "\t[--nologo]\thide splash screen\n"
95+
<< "\t[--optionspath path]\tuse the given QSettings path\n"
9596
<< "\t[--help]\t\tthis 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

Comments
 (0)