Skip to content

Commit

Permalink
quote options with special characters
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@5441 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed May 11, 2006
1 parent 6578d2c commit 38f9677
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/plugins/grass/qgsgrassmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,11 +1100,23 @@ void QgsGrassModule::run()

QStringList list = mOptions->arguments();

QStringList argumentsHtml;
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
std::cerr << "option: " << (*it).toLocal8Bit().data() << std::endl;
//command.append ( " " + *it );
arguments.append ( *it );
//mProcess.addArgument( *it );

// Quote options with special characters so that user
// can copy-paste-run the command
if ( (*it).contains ( QRegExp("[ <>\\$|;&]" ) ) )
{
argumentsHtml.append( "'" + *it + "'" );
}
else
{
argumentsHtml.append( *it );
}
}

/* WARNING - TODO: there was a bug in GRASS 6.0.0 / 6.1.CVS (< 2005-04-29):
Expand All @@ -1118,7 +1130,7 @@ void QgsGrassModule::run()

mOutputTextBrowser->clear();

QString commandHtml = mXName + " " + arguments.join(" ");
QString commandHtml = mXName + " " + argumentsHtml.join(" ");

std::cerr << "command: " << commandHtml.toLocal8Bit().data() << std::endl;
commandHtml.replace ( "&", "&amp;" );
Expand Down

0 comments on commit 38f9677

Please sign in to comment.