diff --git a/.gitignore b/.gitignore index 58cb2528..9e2006b4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.wasm *.cwasm libcbqn.so +libcbqn.dylib *.exe *.dll diff --git a/src/utils/file.c b/src/utils/file.c index 00eada8b..26db5a48 100644 --- a/src/utils/file.c +++ b/src/utils/file.c @@ -323,7 +323,7 @@ void mmap_init() { } bool dir_create(B path) { char* p = toCStr(path); #if defined(_WIN32) || defined(_WIN64) - bool r = 1; + bool r = 0; #else bool r = mkdir(p, S_IRWXU) == 0; #endif @@ -366,11 +366,13 @@ char path_type(B path) { i64 mode = s.st_mode; if (S_ISREG (mode)) return 'f'; if (S_ISDIR (mode)) return 'd'; - if (S_ISLNK (mode)) return 'l'; if (S_ISFIFO(mode)) return 'p'; - if (S_ISSOCK(mode)) return 's'; if (S_ISBLK (mode)) return 'b'; if (S_ISCHR (mode)) return 'c'; + #if !defined(_WIN32) && !defined(_WIN64) + if (S_ISLNK (mode)) return 'l'; + if (S_ISSOCK(mode)) return 's'; + #endif thrM("Unexpected file type"); } diff --git a/src/vm.c b/src/vm.c index c7895f2c..94f9bd30 100644 --- a/src/vm.c +++ b/src/vm.c @@ -6,10 +6,6 @@ #include "utils/interrupt.h" #include -#if defined(_WIN32) || defined(_WIN64) - #include "windows/sysconf.c" -#endif - #ifndef UNWIND_COMPILER // whether to hide stackframes of the compiler in compiling errors #define UNWIND_COMPILER 1 #endif @@ -1134,8 +1130,12 @@ B block_decompose(B x) { return m_hVec2(m_i32(1), x); } static usz pageSizeV; usz getPageSize() { - if (pageSizeV==0) pageSizeV = sysconf(_SC_PAGESIZE); - return pageSizeV; + #if defined(_WIN32) || defined(_WIN64) + err("getPageSize unimplemented on Windows"); + #else + if (pageSizeV==0) pageSizeV = sysconf(_SC_PAGESIZE); + return pageSizeV; + #endif } static void allocStack(void** curr, void** start, void** end, i32 elSize, i32 count) { usz ps = getPageSize(); diff --git a/src/windows/realpath.h b/src/windows/realpath.h index ba43b8ae..aed7bd6b 100644 --- a/src/windows/realpath.h +++ b/src/windows/realpath.h @@ -1,9 +1,6 @@ #ifndef REALPATH_H #define REALPATH_H -#define S_ISLNK(m) (0) -#define S_ISSOCK(m) (0) - char* realpath (const char *__restrict path, char *__restrict resolved_path); #endif /* REALPATH_H */ \ No newline at end of file diff --git a/src/windows/sysconf.c b/src/windows/sysconf.c deleted file mode 100644 index 34c1bdbe..00000000 --- a/src/windows/sysconf.c +++ /dev/null @@ -1,6 +0,0 @@ - -#include "sysconf.h" - -long int sysconf (int in) { - return 1L; -} \ No newline at end of file diff --git a/src/windows/sysconf.h b/src/windows/sysconf.h deleted file mode 100644 index 1d20ef2b..00000000 --- a/src/windows/sysconf.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef SYSCONF_H -#define SYSCONF_H - -#define _SC_PAGESIZE 8 - -long int sysconf (int in); - -#endif /* SYSCONF_H */ \ No newline at end of file