diff options
author | Marius Kintel <marius@kintel.net> | 2013-05-26 19:08:23 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-05-26 19:08:23 (GMT) |
commit | ce11fb2ea2d9b6865fbdb0fc6b31f7cf8a98e11b (patch) | |
tree | 7c3bffce75fdf5f7c4c8558977b7405e5e000e9b /src/module.cc | |
parent | da970b5cc067baeb0edee59ba791e14a7fbfb4c6 (diff) |
Fixed remaining issue. We now correctly detect removal of files as changes. Removed temporary debug output. Fixes #364
Diffstat (limited to 'src/module.cc')
-rw-r--r-- | src/module.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/module.cc b/src/module.cc index 27e01ff..e910c44 100644 --- a/src/module.cc +++ b/src/module.cc @@ -200,10 +200,9 @@ std::string Module::dump(const std::string &indent, const std::string &name) con void FileModule::registerInclude(const std::string &localpath, const std::string &fullpath) { - PRINTB("filemodule reginclude %s -> %s", localpath % fullpath); struct stat st; memset(&st, 0, sizeof(struct stat)); - bool valid = stat(fullpath.c_str(), &st); + bool valid = stat(fullpath.c_str(), &st) == 0; IncludeFile inc = {fullpath, valid, st.st_mtime}; this->includes[localpath] = inc; } @@ -261,12 +260,12 @@ bool FileModule::include_modified(IncludeFile inc) { struct stat st; memset(&st, 0, sizeof(struct stat)); - // FIXME: Detect removal of previously found files + fs::path fullpath = find_valid_path(this->path, inc.filename); - if (!fullpath.empty()) { - bool valid = stat(inc.filename.c_str(), &st); - if (inc.valid != valid) return true; - if (st.st_mtime > inc.mtime) return true; - } + bool valid = !fullpath.empty() ? (stat(boosty::stringy(fullpath).c_str(), &st) == 0) : false; + + if (valid != inc.valid) return true; + if (valid && st.st_mtime > inc.mtime) return true; + return false; } |