fs: init function "issymlink"

This commit is contained in:
Jeremy Baxter 2024-03-24 15:32:03 +13:00
parent 1c408c914e
commit a87c36d61e

19
lfs.c
View file

@ -358,6 +358,24 @@ fs_isfile(lua_State *L)
return istype(L, "file"); return istype(L, "file");
} }
/***
* Returns true if the given path specifies a symbolic link.
* Will return false if either the given path
* does not specify a file or the path
* does not exist at all.
*
* On error returns nil, an error message and a
* platform-dependent error code.
*
* @function issymlink
* @tparam string path The path to check.
*/
static int
fs_issymlink(lua_State *L)
{
return istype(L, "symlink");
}
/*** /***
* Creates a new directory, creating intermediate directories as required. * Creates a new directory, creating intermediate directories as required.
* *
@ -725,6 +743,7 @@ static const luaL_Reg fslib[] = {
{"exists", fs_exists}, {"exists", fs_exists},
{"isdirectory", fs_isdirectory}, {"isdirectory", fs_isdirectory},
{"isfile", fs_isfile}, {"isfile", fs_isfile},
{"issymlink", fs_issymlink},
{"mkdir", fs_mkdir}, {"mkdir", fs_mkdir},
{"mkpath", fs_mkpath}, {"mkpath", fs_mkpath},
{"move", fs_move}, {"move", fs_move},