Skip to content
Permalink
Browse files
quote options with special characters
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5441 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed May 11, 2006
1 parent e49b162 commit 1bc1a869afadf4397e82a36c62600a6d3487cfc0
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/plugins/grass/qgsgrassmodule.cpp
@@ -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):
@@ -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;" );

0 comments on commit 1bc1a86

Please sign in to comment.