[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How to detect symlinks?
- From: Rena <hyperhacker@...>
- Date: Mon, 30 Apr 2012 00:04:25 -0600
On Sun, Apr 29, 2012 at 23:57, Jeff Pohlmeyer <firstname.lastname@example.org> wrote:
> On Sun, Apr 29, 2012 at 11:35 PM, Rena <email@example.com> wrote:
>> How with Lua/LFS can I tell if a file is a symlink? LFS has
>> symlinkattributes, but that only gives information about the link
>> itself, with no apparent way to tell if the file is actually a link or
>> not. (Given a non-symlink, it behaves identically to lfs.attributes.)
> I think this might work:
> function IsSymLink(filename)
> local a = lfs.attributes(filename)
> local s = lfs.symlinkattributes(filename)
> return a and s and ( a.dev ~= s.dev or a.ino ~= s.ino )
> - Jeff
Thanks, that appears to work. Still is there a way to open the link
itself instead of the file it points to?
Sent from my Game Boy.