[luatex] readlink?

Taco Hoekwater taco at elvenkind.com
Mon Mar 1 20:12:39 CET 2010


Elie Roux wrote:
> Taco Hoekwater a écrit :
>> Why not just do io.open(,"w") ? if it fails, you couldn't write. And
>> such a test will do the 'right thing' if the disk is full or mounted
>> read-only.
> 
> That what I do, but this is a bit dirty as a solution...
> 
>> lfs has lfs.symlinkattributes() for this, but I have never
>> used it so I am not sure how useful that is.
> 
> It gives some informations about the link, but it does not tell where it 
> points.

You could use a trick I've used in the past:

   local oldpwd = lfs.currentdir()
   lfs.chdir (link)
   local newpwd = lfs.currentdir()
   lfs.chdir (oldpwd)

and then compare oldpwd and newpwd, but that is not a proper replacement
for readlink(), I agree on that. If you create a tracker item on
tracker.luatex.org, I will (problaby) not forget to add lfs.readlink().

Best wishes,
Taco


More information about the luatex mailing list