qt - trouble passing parameters to console application -


i have trouble correctly launching cloc 1.62 windows command line using qprocess. here have:

a qstringlist languages cloc recognizes;

qstringlist languages; languages<<"\"abap\""<<"\"actionscript\""<<"\"ada\""<<"\"adso/idsm\""<<"\"ample\""<<"\"ant\""<<"\"apex trigger\"";                                     

then create qstring consisting of of list's elements separated comma, exept one, stored in lang variable;

qstring langsinuse;                   (int i=0;i<languages.length();i++)                  {                      if (languages.at(i) != lang)                      {                          if (langsinuse.isempty())                          {                              langsinuse=langsinuse+languages.at(i);                          }                          else                          {                              langsinuse=langsinuse+','+languages.at(i);                          }                      }                  } 

then build arguments stringlist , launch process:

qstringlist arguments; qprocess cloc; qstring params="cloc-1.62.exe --xml --by-file --report-file="+ list1.at(1).trimmed()+'/'+name+'/'+"report.xml"+" --exclude-lang="+langsinuse+" "+distr; arguments<<"/k"<<params; cloc.startdetached("cmd.exe",arguments,"cloc/"); 

but somehow spaces in languages names not considered escaped , every word separated space considered different parameter cloc, though both words in double quotes (for example "\"apex trigger\"") , clock produces bunch of errors.

(50 errors:

unable read: trigger","arduino

unable read: sketch","asp","asp.net","assembly","autohotkey","awk","bourne)

it's error happens when don't put language's name contains spaces in double quotes, int --exclude-lang= option (for example --exclude-lang=apex trigger cause error, --exclude-lang="apex trigger" won't)

however if save whole command build in qt , save in batch file runs fine.

am missing in escaping double quotes correctly?

ok had pass arguments separately , not single string.

arguments<<"/k"<<"cloc-1.62.exe" <<"--xml"<<"--by-file"<<"--report-file="+ list1.at(1).trimmed()+'/'+name+'/'+"report.xml"<<"--exclude-lang="+langsinuse<<distr; 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -