Skip to content

Commit 38f9677

Browse files
author
rblazek
committedMay 11, 2006
quote options with special characters
git-svn-id: http://svn.osgeo.org/qgis/trunk@5441 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 6578d2c commit 38f9677

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed
 

‎src/plugins/grass/qgsgrassmodule.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,11 +1100,23 @@ void QgsGrassModule::run()
11001100

11011101
QStringList list = mOptions->arguments();
11021102

1103+
QStringList argumentsHtml;
11031104
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
11041105
std::cerr << "option: " << (*it).toLocal8Bit().data() << std::endl;
11051106
//command.append ( " " + *it );
11061107
arguments.append ( *it );
11071108
//mProcess.addArgument( *it );
1109+
1110+
// Quote options with special characters so that user
1111+
// can copy-paste-run the command
1112+
if ( (*it).contains ( QRegExp("[ <>\\$|;&]" ) ) )
1113+
{
1114+
argumentsHtml.append( "'" + *it + "'" );
1115+
}
1116+
else
1117+
{
1118+
argumentsHtml.append( *it );
1119+
}
11081120
}
11091121

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

11191131
mOutputTextBrowser->clear();
11201132

1121-
QString commandHtml = mXName + " " + arguments.join(" ");
1133+
QString commandHtml = mXName + " " + argumentsHtml.join(" ");
11221134

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

0 commit comments

Comments
 (0)
Please sign in to comment.