diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-09-20 12:52:54 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-09-20 12:52:54 -0400 |
| commit | 3c41c2d84b8de5a95a322a3f0d8424adf6df8667 (patch) | |
| tree | 0a0722e68311711a6b9dafafa3c713184cd13306 /src/os.cpp | |
| parent | 32c51e015674af346aae1c3f40fed9ef098a6693 (diff) | |
| parent | c4a54377e3f07bbd2f9c54c1962c7941792c2c1f (diff) | |
| download | zig-3c41c2d84b8de5a95a322a3f0d8424adf6df8667.tar.gz zig-3c41c2d84b8de5a95a322a3f0d8424adf6df8667.zip | |
Merge branch 'master' into c-to-zig
Diffstat (limited to 'src/os.cpp')
| -rw-r--r-- | src/os.cpp | 12 |
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; } |
