If I want to pass a wildcard filespec on the command line, something like the following:
myapp *.txt
I would use UnlabeledValueArg, which works fine unless the second half of the wildcard spec is another '*' in which case it fails the _hasBlanks check in processArg and the CmdLineParseException gets thrown with "Couldn't find match for argument", what is the best way around this. Should I derive another Arg class to return a different blankChar??
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yeah, I wouldn't call cmd.exe in Windows shell by any means. I'm sure that there are files to match, in fact, if I change blankChar() to return something like '%' instead of '*' it works fine. and I can pass file names in directly, and there are no spaces in the name.
If I dump the arguments as passed in on the command line I get the exact wildcard string *.*, Windows shell does no exapansion of wildcards, so I think I'm going to have to do some kind of escaping to get it to work with TCLAP.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't use windoze, but I used DOS back in the days... If I recall DOS expanded wildcards in a limited way. For instance it would match hello.txt and hi.txt to *.txt and hello.txt to ?ello.txt but did not handle multiple wildcards such that *.t* would not match hello.txt or hello.tex. Wild card expansion is something that (I believe) should be done by the shell and not by every single applications out there (why do it 10'000 times if 1 is enough?) so I don't fancy including it in TCLAP. But if it is requested by many windows users.... we might have to do it. It's not difficult to do, just stupid as it should be done by a decent shell anyway.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This of course only works if you specifically link with Setargv.obj. If you do link with Setargv.obj everything works as it should, but if you don't the wildcard gets passed literally. Thanks for the help and the patience, and the great library.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If I want to pass a wildcard filespec on the command line, something like the following:
myapp *.txt
I would use UnlabeledValueArg, which works fine unless the second half of the wildcard spec is another '*' in which case it fails the _hasBlanks check in processArg and the CmdLineParseException gets thrown with "Couldn't find match for argument", what is the best way around this. Should I derive another Arg class to return a different blankChar??
Have a look at the following:
http://tclap.sourceforge.net/manual.html#UNLABELED_MULTI_ARG
Wildcard are not handled by TCLAP, these are handled by the shell (Well if you can call what Windows has a shell.). TCLAP never sees the wildcards.
Are you sure that there are files to match your wildcard argument? Perhaps there are no arguments at all.
Are there spaces in the filenames. Can you pass the filenames in directly, without using wildcards?
If you want to pass the wildcards to myapp, you will need to either escape them or quote them (I'm not sure with Winders.).
I think we need a little more information to help.
Erik
Yeah, I wouldn't call cmd.exe in Windows shell by any means. I'm sure that there are files to match, in fact, if I change blankChar() to return something like '%' instead of '*' it works fine. and I can pass file names in directly, and there are no spaces in the name.
If I dump the arguments as passed in on the command line I get the exact wildcard string *.*, Windows shell does no exapansion of wildcards, so I think I'm going to have to do some kind of escaping to get it to work with TCLAP.
I don't use windoze, but I used DOS back in the days... If I recall DOS expanded wildcards in a limited way. For instance it would match hello.txt and hi.txt to *.txt and hello.txt to ?ello.txt but did not handle multiple wildcards such that *.t* would not match hello.txt or hello.tex. Wild card expansion is something that (I believe) should be done by the shell and not by every single applications out there (why do it 10'000 times if 1 is enough?) so I don't fancy including it in TCLAP. But if it is requested by many windows users.... we might have to do it. It's not difficult to do, just stupid as it should be done by a decent shell anyway.
Ok.. leave it up to Microsoft to complicate things and chalk the rest of it up to my inexperience with the Windows command line environment.
I did some poking around on MSDN and found the following tidbit on wild card expansion:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccelng/htm/basic_22.asp
This of course only works if you specifically link with Setargv.obj. If you do link with Setargv.obj everything works as it should, but if you don't the wildcard gets passed literally. Thanks for the help and the patience, and the great library.