lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Tomas Guisasola Gorham wrote:
>> Sorry for the confusion :). I meant for the last option to be
>> compatible with duck's original request, i.e. return a table of mode
>> strings (which could indicate `file', `directory', `link to file',
>> `link to directory', `link to nothing', etc.). I wouldn't personally
>> go this way because I think the user should follow links unless
>> he/she explicitly requests not to (lstat/lattributes). 
> 	Ok.  Then I think we could reduce the options to two :-) At the
> moment I'll stay with Sam's implementation, just changing the name of
> the new function to `linkattributes':  
> 
> lfs.linkattributes("link", "mode") --> "link"
> lfs.attributes("link", "mode") --> "file"
> 
> 	What do you think?

Is it not possible to add a new attribute to the attributes table ? This
approach wouldn't break existing apps. Something like:

lfs.attributes("normalfile", "mode") --> "file"
lfs.attributes("normalfile", "symlink") --> false
lfs.attributes("linkedfile", "mode") --> "file"
lfs.attributes("linkedfile", "symlink") --> true

"symlink" may be more appropriate than avoid confusion with hard links
("nlink").