Add a 'target' field for symlinkattributes.

It returns the resolved path of the symlink.

Original version by Hisham <hisham@gobolinux.org>, modified to
use a different strategy for sizing the readlink() buffer.
This commit is contained in:
NiteHawk
2016-07-16 15:35:27 +02:00
parent 080f74f785
commit 32b355a990
3 changed files with 52 additions and 1 deletions

View File

@@ -91,6 +91,8 @@ io.flush()
if lfs.link (tmpfile, "_a_link_for_test_", true) then
assert (lfs.attributes"_a_link_for_test_".mode == "file")
assert (lfs.symlinkattributes"_a_link_for_test_".mode == "link")
assert (lfs.symlinkattributes"_a_link_for_test_".target == tmpfile)
assert (lfs.symlinkattributes("_a_link_for_test_", "target") == tmpfile)
assert (lfs.link (tmpfile, "_a_hard_link_for_test_"))
assert (lfs.attributes (tmpfile, "nlink") == 2)
assert (os.remove"_a_link_for_test_")