summaryrefslogtreecommitdiff
path: root/core/src/xmake/os/islink.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/xmake/os/islink.c')
-rw-r--r--core/src/xmake/os/islink.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/core/src/xmake/os/islink.c b/core/src/xmake/os/islink.c
index c7fec236e..b5662c369 100644
--- a/core/src/xmake/os/islink.c
+++ b/core/src/xmake/os/islink.c
@@ -29,9 +29,6 @@
* includes
*/
#include "prefix.h"
-#ifndef TB_CONFIG_OS_WINDOWS
-# include <sys/stat.h>
-#endif
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
@@ -46,16 +43,7 @@ tb_int_t xm_os_islink(lua_State* lua)
tb_check_return_val(path, 0);
// is link?
-#if defined(TB_CONFIG_OS_WINDOWS)
- lua_pushboolean(lua, tb_false);
-#elif defined(TB_CONFIG_POSIX_HAVE_STAT64)
- struct stat64 st = {0};
- lua_pushboolean(lua, !lstat64(path, &st) && S_ISLNK(st.st_mode));
-#else
- struct stat st = {0};
- lua_pushboolean(lua, !lstat(path, &st) && S_ISLNK(st.st_mode));
-#endif
-
- // ok
+ tb_file_info_t info = {0};
+ lua_pushboolean(lua, tb_file_info(path, &info) && (info.flags & TB_FILE_FLAG_LINK));
return 1;
}