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? Thanks, Dan
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
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 HeesobExcellent, thank you! I''ve committed to CVS. Regards, Dan