File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff 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 ( " &" , " &" );
You can’t perform that action at this time.
0 commit comments