[Win32utils-devel] File.readlink for Vista?
Daniel Berger
djberg96 at gmail.com
Wed Nov 12 20:52:23 EST 2008
Heesob Park wrote:
> Hi,
>
> 2008/11/12 Daniel Berger <djberg96 at gmail.com>:
>> Hi,
>>
>> I've implemented File.symlink and File.symlink? in the win32-file library,
>> but I'm not sure how to implement File.readlink. I searched Google for a
>> while but found nothing.
>>
>> Any suggestions?
>>
> Here is File.readlink implementation
>
> def readlink(file)
> hFile = CreateFile(file,
> GENERIC_READ,
> FILE_SHARE_READ,
> nil,
> OPEN_EXISTING,
> FILE_ATTRIBUTE_NORMAL,
> nil)
> path = 0.chr * 256
> GetFinalPathNameByHandle(hFile,path,256,0)
> CloseHandle(hFile)
> path.strip[4..-1] # get rid of prepending "\\?\"
> end
>
> Regards,
>
> Park Heesob
Excellent, thank you!
I've committed to CVS.
Regards,
Dan
More information about the win32utils-devel
mailing list