win32+popen4

Peter Hansen peter at engcorp.com
Fri Mar 1 21:20:39 EST 2002


Robin Becker wrote:
> 
> >I'm pretty sure the last time I checked the PROGRA~1 convention still
> >worked on WinNT.  
> >
> I'm sure it does and I guess that Program Files will always match as
> it's often the first. On the other hand working with a path name
> obtained from an execution path there's no guarantee I can always do the
> correct conversion by assuming ~1, some end up as ~2 etc.
> 
> Is there a proper way to get the 8.3 name?

As Thomas showed, or more concisely with win32api.GetShortPathName().

But if this is not an application for distribution, you can 
definitely be 99.99% safe relying on progra~1 for that specific
file name, since "program files" will be the first directory
created with that pattern on almost any WinNT system.

I'm just keeping Python pragmatism in mind: if I don't _really_
need to fix it, I wouldn't spend any more time on it, ugly 
though this solution is.

-Peter



More information about the Python-list mailing list