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()
1100
1100
1101
1101
QStringList list = mOptions ->arguments ();
1102
1102
1103
+ QStringList argumentsHtml;
1103
1104
for ( QStringList::Iterator it = list.begin (); it != list.end (); ++it ) {
1104
1105
std::cerr << " option: " << (*it).toLocal8Bit ().data () << std::endl;
1105
1106
// command.append ( " " + *it );
1106
1107
arguments.append ( *it );
1107
1108
// 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
+ }
1108
1120
}
1109
1121
1110
1122
/* WARNING - TODO: there was a bug in GRASS 6.0.0 / 6.1.CVS (< 2005-04-29):
@@ -1118,7 +1130,7 @@ void QgsGrassModule::run()
1118
1130
1119
1131
mOutputTextBrowser ->clear ();
1120
1132
1121
- QString commandHtml = mXName + " " + arguments .join (" " );
1133
+ QString commandHtml = mXName + " " + argumentsHtml .join (" " );
1122
1134
1123
1135
std::cerr << " command: " << commandHtml.toLocal8Bit ().data () << std::endl;
1124
1136
commandHtml.replace ( " &" , " &" );
You can’t perform that action at this time.
0 commit comments