summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-05-02 03:08:26 (GMT)
committerEvan Martin <martine@danga.com>2011-05-02 14:21:39 (GMT)
commit23a7aa78bf2a8fffc27eec74e928c6681d11f094 (patch)
tree747bb5c3b5765916b06662902625dee994052ab9
parentd402c39e9d0c7cb87f550a2e3ac6dc074b528a17 (diff)
downloadNinja-23a7aa78bf2a8fffc27eec74e928c6681d11f094.zip
Ninja-23a7aa78bf2a8fffc27eec74e928c6681d11f094.tar.gz
Ninja-23a7aa78bf2a8fffc27eec74e928c6681d11f094.tar.bz2
windows: use abstractions in ninja.cc
-rw-r--r--src/ninja.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/ninja.cc b/src/ninja.cc
index 43b19ea..fbae091 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -15,11 +15,6 @@
#include "ninja.h"
#include <errno.h>
-#ifdef WIN32
-#include "getopt.h"
-#else
-#include <getopt.h>
-#endif
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
@@ -31,6 +26,14 @@
#include <sys/sysinfo.h>
#endif
+#ifdef WIN32
+#include "getopt.h"
+#include <direct.h>
+#include <windows.h>
+#else
+#include <getopt.h>
+#endif
+
#include "browse.h"
#include "build.h"
#include "build_log.h"
@@ -378,7 +381,11 @@ int main(int argc, char** argv) {
argc -= optind;
if (working_dir) {
+#ifdef _WIN32
+ if (_chdir(working_dir) < 0) {
+#else
if (chdir(working_dir) < 0) {
+#endif
Fatal("chdir to '%s' - %s", working_dir, strerror(errno));
}
}
@@ -416,7 +423,7 @@ int main(int argc, char** argv) {
const char* kLogPath = ".ninja_log";
string log_path = kLogPath;
if (!build_dir.empty()) {
- if (mkdir(build_dir.c_str(), 0777) < 0 && errno != EEXIST) {
+ if (MakeDir(build_dir) < 0 && errno != EEXIST) {
Error("creating build directory %s: %s",
build_dir.c_str(), strerror(errno));
return 1;