summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-13 00:49:33 +0800
committerruki <[email protected]>2020-02-12 22:57:23 +0800
commit4cd450c954ecea35e8854dac5ad1062281bfc4c1 (patch)
tree530addc8d1a2cdfa00d9ade4a6857d7d98cf90af
parent7b08be3acbeeb49f691302ee9262a053171c70d5 (diff)
improve os module to support msys
-rw-r--r--core/src/xmake/io/file_rawfd.c2
-rw-r--r--core/src/xmake/os/getenv.c2
-rw-r--r--core/src/xmake/os/getenvs.c8
-rw-r--r--core/src/xmake/os/getwinsize.c4
4 files changed, 8 insertions, 8 deletions
diff --git a/core/src/xmake/io/file_rawfd.c b/core/src/xmake/io/file_rawfd.c
index 68efcd4b8..f3d869747 100644
--- a/core/src/xmake/io/file_rawfd.c
+++ b/core/src/xmake/io/file_rawfd.c
@@ -35,7 +35,7 @@
*/
// file to fd
-#ifdef TB_CONFIG_OS_WINDOWS
+#if defined(TB_CONFIG_OS_WINDOWS) && !defined(TB_COMPILER_LIKE_UNIX)
# define xm_io_file2fd(file) (lua_Number)((tb_size_t)(file))
#else
# define xm_io_file2fd(file) (lua_Number)tb_file2fd(file)
diff --git a/core/src/xmake/os/getenv.c b/core/src/xmake/os/getenv.c
index 37490eeb2..0f42e5081 100644
--- a/core/src/xmake/os/getenv.c
+++ b/core/src/xmake/os/getenv.c
@@ -35,7 +35,7 @@
*/
// the separator
-#ifdef TB_CONFIG_OS_WINDOWS
+#if defined(TB_CONFIG_OS_WINDOWS) && !defined(TB_COMPILER_LIKE_UNIX)
# define XM_OS_ENV_SEP ';'
#else
# define XM_OS_ENV_SEP ':'
diff --git a/core/src/xmake/os/getenvs.c b/core/src/xmake/os/getenvs.c
index 340700f2b..952355456 100644
--- a/core/src/xmake/os/getenvs.c
+++ b/core/src/xmake/os/getenvs.c
@@ -29,7 +29,7 @@
* includes
*/
#include "prefix.h"
-#ifdef TB_CONFIG_OS_WINDOWS
+#if defined(TB_CONFIG_OS_WINDOWS) && !defined(TB_COMPILER_LIKE_UNIX)
# include <windows.h>
#endif
@@ -38,7 +38,7 @@
*/
// the separator
-#ifdef TB_CONFIG_OS_WINDOWS
+#if defined(TB_CONFIG_OS_WINDOWS) && !defined(TB_COMPILER_LIKE_UNIX)
# define XM_OS_ENV_SEP ';'
#else
# define XM_OS_ENV_SEP ':'
@@ -49,7 +49,7 @@
*/
// the user environment
-#ifndef TB_CONFIG_OS_WINDOWS
+#if !defined(TB_CONFIG_OS_WINDOWS) || defined(TB_COMPILER_LIKE_UNIX)
extern tb_char_t** environ;
#endif
@@ -64,7 +64,7 @@ tb_int_t xm_os_getenvs(lua_State* lua)
// init table
lua_newtable(lua);
-#ifdef TB_CONFIG_OS_WINDOWS
+#if defined(TB_CONFIG_OS_WINDOWS) && !defined(TB_COMPILER_LIKE_UNIX)
tb_wchar_t const* p = (tb_wchar_t const*)GetEnvironmentStringsW();
if (p)
{
diff --git a/core/src/xmake/os/getwinsize.c b/core/src/xmake/os/getwinsize.c
index 34e095545..3942b7e2b 100644
--- a/core/src/xmake/os/getwinsize.c
+++ b/core/src/xmake/os/getwinsize.c
@@ -29,7 +29,7 @@
* includes
*/
#include "prefix.h"
-#ifdef TB_CONFIG_OS_WINDOWS
+#if defined(TB_CONFIG_OS_WINDOWS) && !defined(TB_COMPILER_LIKE_UNIX)
# include <windows.h>
#else
# include <sys/ioctl.h>
@@ -51,7 +51,7 @@ tb_int_t xm_os_getwinsize(lua_State* lua)
tb_int_t w = TB_MAXS16, h = TB_MAXS16;
// get winsize
-#ifdef TB_CONFIG_OS_WINDOWS
+#if defined(TB_CONFIG_OS_WINDOWS) && !defined(TB_COMPILER_LIKE_UNIX)
CONSOLE_SCREEN_BUFFER_INFO csbi;
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi))
{