[python-win32] Try to got short path for files - but goterror...

Metz, Bobby W, WWCS bwmetz at att.com
Thu May 25 12:12:29 CEST 2006


Mark,
	Thanks for that.  I didn't read an earlier entry from the
submitter close enough.  Someone else had told them that
GetShortPathName wasn't supported but I didn't pay attention to the W at
the end...could have saved myself a couple of posts if I had.  I'll
chalk my "lack of clear direction" up to this as well...I was excluding
GetShortPathName in my search due to comment below.

>>     Looks like you need a GetShortPathNameW() but it's not
implemented.
>>     Raise it as an issue on the pywin32 sourceforge bug register.
>>     Tell Mark
>>     I sent you :-)

Thanks,

Bobby

-----Original Message-----
From: Mark Hammond [mailto:mhammond at skippinet.com.au]
Sent: Wednesday, May 24, 2006 6:15 PM
To: Metz, Bobby W, WWCS; DurumDara; python-win32 at python.org
Subject: RE: [python-win32] Try to got short path for files - but
goterror...


> Mark,
> 	Do you know if it's possible to get all the usual "right-click"
> file properties using win32com or ctypes?  I know Windows presents
short
> names via properties, but wasn't sure that's exposed via either.  I
> googled this but didn't see a clear direction after the first 50 hits.
> May be a bad search on my part.

I believe all properties can be fetched fine, including 'extended'
properties via COM.

But I've lost the context here - 'clear direction' for what exactly?

eg, I created a long filename c:\temp\Copyright someone.txt and:

>>> win32api.GetShortPathName(u"c:\\temp\\\xa9opyright
someone.txt".encode("mbcs"))
'c:\\temp\\OPYRIG~1.TXT'
>>> open('c:\\temp\\OPYRIG~1.TXT')
<open file 'c:\temp\OPYRIG~1.TXT', mode 'r' at 0x008CF5E0>
>>>

It also dawned on me that the "short name" of a file should never
contain
unicode characters!  That seems to be demonstrated above...

Mark



More information about the Python-win32 mailing list