summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/xmake/os/strerror.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/src/xmake/os/strerror.c b/core/src/xmake/os/strerror.c
index 7f0b5e3bb..e4d3b7fa3 100644
--- a/core/src/xmake/os/strerror.c
+++ b/core/src/xmake/os/strerror.c
@@ -29,7 +29,9 @@
* includes
*/
#include "prefix.h"
-#if !defined(TB_CONFIG_OS_WINDOWS) || defined(TB_COMPILER_LIKE_UNIX)
+#if defined(TB_CONFIG_OS_WINDOWS) && !defined(TB_COMPILER_LIKE_UNIX)
+# include <windows.h>
+#else
# include <errno.h>
# include <string.h>
#endif
@@ -68,7 +70,9 @@ tb_int_t xm_os_strerror(lua_State* lua)
else
{
#if defined(TB_CONFIG_OS_WINDOWS) && !defined(TB_COMPILER_LIKE_UNIX)
- lua_pushstring(lua, "Unknown");
+ tb_char_t strerr[128] = {0};
+ tb_snprintf(strerr, sizeof(strerr), "Unknown Error (%lu)", (tb_size_t)GetLastError());
+ lua_pushstring(lua, strerr);
#else
lua_pushstring(lua, strerror(errno));
#endif