
On 5 January 2015 at 20:33, <random832@fastmail.us> wrote:
On Mon, Jan 5, 2015, at 05:10, Andrew Barnert wrote:
It seems to me that if you want auto-globbing support on Windows, the "right" way to do it is to link in the fancy setargv instead of the default one. This handles wildcards exactly the same way the command.com/cmd.exe builtin commands do, which I suspect is what Windows users would actually be expecting of they passed a wildcard on the command line. (I think the docs no longer guarantee that this is true, but it's probably still true, and certainly closer to true than if you try to do it manually.)
The problem with that is that if you do that you can no longer pass in _non_-filename arguments that contain a question mark or asterisk (and happen to match a file). Better to do it inside the program, when you actually know the argument you're looking at is intended to be a filename spec. Which, I assume, is _why_ it's not done by default when you compile a C program.
Just as a note - I find the fact that Python *doesn't* allow the C runtime to do its glob-mangling of the supplied command arguments a very useful feature, and I would not want it to be "fixed". The setargv behaviour in the MSVC runtime is full of arcane corner cases and quoting gotchas, and I wouldn't want it imposed on me by default. Paul