[David Ascher] > A python-help poster finally convinced me that there was a way to enable > automatic wildcard expansion on win32. This is done by linking in > "setargv.obj" along with all of the other MS libs. Quick testing shows > that it works. > > Is this a feature we want to add? I can see both sides of that coin. The only real drawback I see is that we're then under some obligation to document Python's behavior. Which is then inherited from the MS setargv.obj, which is in turn only partially documented in developer-only docs, and incorrectly documented at that. > PS: I saw a RISKS digest posting last week which had a horror story about > wildcard expansion on some flavor of Windows. The person had two files > with long filenames: > > verylongfile1.txt > and > verylongfile2.txt > > But Win32 stored them in 8.3 format, so they were stored as > verylo~2.txt > and > verylo~1.txt > > (Yes, the 1 and 2 were swapped!). So when he did > > del *1.txt > > he removed the wrong file. Neat, eh? > > (This is actually relevant -- it's possible that setargv.obj and > glob.glob could give different answers). Yes, and e.g. it works this way under Win95: D:\Python>dir *~* Volume in drive D is DISK1PART2 Volume Serial Number is 1DFF-0F59 Directory of D:\Python PYCLBR~1 PAT 5,765 06-07-99 11:41p pyclbr.patch KJBUCK~1 PYD 34,304 03-31-98 3:07a kjbuckets.pyd WIN32C~1 <DIR> 05-16-99 12:10a win32comext PYTHON~1 <DIR> 05-16-99 12:10a Pythonwin TEXTTO~1 <DIR> 01-15-99 11:35p TextTools UNWISE~1 EXE 109,056 07-03-97 8:35a UnWisePW32.exe 3 file(s) 149,125 bytes 3 dir(s) 1,502,511,104 bytes free Here's the same thing in an argv-spewing console app whipped up to link setargv.obj: D:\Python>garp\debug\garp *~* 0: D:\PYTHON\GARP\DEBUG\GARP.EXE 1: kjbuckets.pyd 2: pyclbr.patch 3: Pythonwin 4: TextTools 5: UnWisePW32.exe 6: win32comext D:\Python> setargv.obj is apparently consistent with what native wildcard expansion does (although you won't find that promise made anywhere!), and it's definitely surprising in the presence of non-8.3 names. The quoting rules too are impossible to explain, seemingly random: D:\Python>garp\debug\garp "\\a\\" 0: D:\PYTHON\GARP\DEBUG\GARP.EXE 1: \\a\ D:\Python> Before I was on the Help list, I used to believe it would work to just say "well, it does what Windows does" <wink>. magnification-of-ignorance-ly y'rs - tim
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4