lunarmodules / luafilesystem

LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution.
https://lunarmodules.github.io/luafilesystem/
MIT License
900 stars 291 forks source link

error when retrieve symlinkatrributes at directory symlink #157

Open robertlzj opened 2 years ago

robertlzj commented 2 years ago

Hi,

local lfs=require'lfs'
print(lfs._VERSION)--1.8.0
local file1,file2='test_directory','symlink-directory'
assert(not lfs.attributes(file1) and not  lfs.attributes(file2))
lfs.mkdir(file1)
lfs.link(file1,file2,true)
assert(lfs.symlinkattributes(file2,'target')=="Input/output error")--should be path
assert(not pcall(lfs.symlinkattributes,file2))--should not raise error 'attempt to index a nil value'
return 

works correct on file.

Windows 10 x64

cevhyruz commented 1 year ago

Same. I don't know if it's intended but target field only exists on broken symlinks.