Skip to content

Commit

Permalink
Add option to set QSettings path
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13045 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 11, 2010
1 parent ab9e926 commit c5452ac
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/app/main.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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() ) );
Expand Down

0 comments on commit c5452ac

Please sign in to comment.