diff options
author | Evan Martin <martine@danga.com> | 2011-01-07 19:51:24 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-01-07 19:51:24 (GMT) |
commit | e5ae916071a4e8467d7649a5cc700ca7310b6b69 (patch) | |
tree | e3e496b8a3d454015042aade5c653f18e773390d | |
parent | 28f2bf6e81a04004e9971cce0642f29dac1e4034 (diff) | |
download | Ninja-e5ae916071a4e8467d7649a5cc700ca7310b6b69.zip Ninja-e5ae916071a4e8467d7649a5cc700ca7310b6b69.tar.gz Ninja-e5ae916071a4e8467d7649a5cc700ca7310b6b69.tar.bz2 |
reread previous log on startup
-rw-r--r-- | src/build_log.cc | 2 | ||||
-rw-r--r-- | src/ninja.cc | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/build_log.cc b/src/build_log.cc index 06db0e6..ba09b46 100644 --- a/src/build_log.cc +++ b/src/build_log.cc @@ -52,6 +52,8 @@ void BuildLog::Close() { bool BuildLog::Load(const string& path, string* err) { FILE* file = fopen(path.c_str(), "r"); if (!file) { + if (errno == ENOENT) + return true; *err = strerror(errno); return false; } diff --git a/src/ninja.cc b/src/ninja.cc index f88e2b9..a39ff5c 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -90,9 +90,17 @@ int main(int argc, char** argv) { return 0; } + const char* kLogPath = "ninja_log"; BuildLog log; - if (!log.OpenForWrite("ninja_log", &err)) + if (!log.Load(kLogPath, &err)) { + fprintf(stderr, "error loading build log: %s\n", err.c_str()); return 1; + } + + if (!log.OpenForWrite(kLogPath, &err)) { + fprintf(stderr, "error opening build log: %s\n", err.c_str()); + return 1; + } config.build_log = &log; Builder builder(&state, config); |