summaryrefslogtreecommitdiffstats
path: root/src/disk_interface.cc
diff options
context:
space:
mode:
authorFredrik Medley <fredrik.medley@autoliv.com>2017-12-15 20:37:37 (GMT)
committerFredrik Medley <fredrik.medley@autoliv.com>2017-12-19 13:55:04 (GMT)
commited11516a03583602fbaae2748f3d428542096136 (patch)
tree47a8d4b27415663920d565d972b37556c476e76e /src/disk_interface.cc
parente234a7bdb6c42f4539c0ab09b624f191287c2c10 (diff)
downloadNinja-ed11516a03583602fbaae2748f3d428542096136.zip
Ninja-ed11516a03583602fbaae2748f3d428542096136.tar.gz
Ninja-ed11516a03583602fbaae2748f3d428542096136.tar.bz2
Fix disk_interface_test.cc on Windows for 64-bit timestamp
subdir/subsubdir/.. seems to get the time of subdir/subsubdir on NTFS (Windows 7), not the time of subdir.
Diffstat (limited to 'src/disk_interface.cc')
-rw-r--r--src/disk_interface.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/disk_interface.cc b/src/disk_interface.cc
index 4b4c4c7..aba6ab2 100644
--- a/src/disk_interface.cc
+++ b/src/disk_interface.cc
@@ -112,6 +112,11 @@ bool StatAllFilesInDir(const string& dir, map<string, TimeStamp>* stamps,
}
do {
string lowername = ffd.cFileName;
+ if (lowername == "..") {
+ // Seems to just copy the timestamp for ".." from ".", which is wrong.
+ // This is the case at least on NTFS under Windows 7.
+ continue;
+ }
transform(lowername.begin(), lowername.end(), lowername.begin(), ::tolower);
stamps->insert(make_pair(lowername,
TimeStampFromFileTime(ffd.ftLastWriteTime)));
@@ -164,6 +169,11 @@ TimeStamp RealDiskInterface::Stat(const string& path, string* err) const {
string dir = DirName(path);
string base(path.substr(dir.size() ? dir.size() + 1 : 0));
+ if (base == "..") {
+ // StatAllFilesInDir does not report any information for base = "..".
+ base = ".";
+ dir = path;
+ }
transform(dir.begin(), dir.end(), dir.begin(), ::tolower);
transform(base.begin(), base.end(), base.begin(), ::tolower);