summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-31 00:50:20 +0800
committerruki <[email protected]>2022-08-31 00:50:20 +0800
commit3e398cf349c1ff3b9e9ebfa92f9dff99dfa8a97f (patch)
tree5d746de1bcd242f4f4c11f35237554ac897ff64f
parent1ac88d2b07043fff092b1d8d757ab391e59a057d (diff)
revert islink
-rw-r--r--core/src/xmake/os/islink.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/core/src/xmake/os/islink.c b/core/src/xmake/os/islink.c
index d70681cb5..c7fec236e 100644
--- a/core/src/xmake/os/islink.c
+++ b/core/src/xmake/os/islink.c
@@ -46,7 +46,16 @@ tb_int_t xm_os_islink(lua_State* lua)
tb_check_return_val(path, 0);
// is link?
- tb_file_info_t info = {0};
- lua_pushboolean(lua, tb_file_info(path, &info) && (info.flags & TB_FILE_FLAG_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
return 1;
}