aboutsummaryrefslogtreecommitdiff
path: root/src/os.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/os.cpp')
-rw-r--r--src/os.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/os.cpp b/src/os.cpp
index 363d6fbf32..65ca9d8cbe 100644
--- a/src/os.cpp
+++ b/src/os.cpp
@@ -25,6 +25,8 @@
#include <windows.h>
#include <io.h>
+
+typedef SSIZE_T ssize_t;
#else
#define ZIG_OS_POSIX
@@ -620,7 +622,7 @@ int os_get_cwd(Buf *out_cwd) {
bool os_stderr_tty(void) {
#if defined(ZIG_OS_WINDOWS)
- return _isatty(STDERR_FILENO) != 0;
+ return _isatty(_fileno(stderr)) != 0;
#elif defined(ZIG_OS_POSIX)
return isatty(STDERR_FILENO) != 0;
#else
@@ -777,12 +779,12 @@ int os_make_path(Buf *path) {
int os_make_dir(Buf *path) {
#if defined(ZIG_OS_WINDOWS)
- if (mkdir(buf_ptr(path)) == -1) {
- if (errno == EEXIST)
+ if (!CreateDirectory(buf_ptr(path), NULL)) {
+ if (GetLastError() == ERROR_ALREADY_EXISTS)
return ErrorPathAlreadyExists;
- if (errno == ENOENT)
+ if (GetLastError() == ERROR_PATH_NOT_FOUND)
return ErrorFileNotFound;
- if (errno == EACCES)
+ if (GetLastError() == ERROR_ACCESS_DENIED)
return ErrorAccess;
return ErrorUnexpected;
}