Skip to content
Permalink
Browse files

Add option to set QSettings path

git-svn-id: http://svn.osgeo.org/qgis/trunk@13045 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Mar 11, 2010
1 parent 4852ceb commit 57469b44b25d959f884b85634fc20385fddb8dd8
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/app/main.cpp
@@ -92,6 +92,7 @@ void usage( std::string const & appName )
<< "\t[--project projectfile]\tload the given QGIS project\n"
<< "\t[--extent xmin,ymin,xmax,ymax]\tset initial map extent\n"
<< "\t[--nologo]\thide splash screen\n"
<< "\t[--optionspath path]\tuse the given QSettings path\n"
<< "\t[--help]\t\tthis text\n\n"
<< " FILES:\n"
<< " Files specified on the command line can include rasters,\n"
@@ -303,13 +304,14 @@ int main( int argc, char *argv[] )
{"lang", required_argument, 0, 'l'},
{"project", required_argument, 0, 'p'},
{"extent", required_argument, 0, 'e'},
{"optionspath", required_argument, 0, 'o'},
{0, 0, 0, 0}
};

/* getopt_long stores the option index here. */
int option_index = 0;

optionChar = getopt_long( argc, argv, "swhlpe",
optionChar = getopt_long( argc, argv, "swhlpeo",
long_options, &option_index );

/* Detect the end of the options. */
@@ -356,6 +358,10 @@ int main( int argc, char *argv[] )
myInitialExtent = optarg;
break;

case 'o':
QSettings::setPath( QSettings::NativeFormat, QSettings::UserScope, optarg );
break;

case '?':
usage( argv[0] );
return 2; // XXX need standard exit codes
@@ -420,6 +426,10 @@ int main( int argc, char *argv[] )
{
myInitialExtent = argv[++i];
}
else if ( i + 1 < argc && ( arg == "--optionspath" || arg == "-o" ) )
{
QSettings::setPath( QSettings::NativeFormat, QSettings::UserScope, argv[++i] );
}
else
{
myFileList.append( QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() ) );

0 comments on commit 57469b4

Please sign in to comment.
You can’t perform that action at this time.