diff options
author | Nico Weber <nicolasweber@gmx.de> | 2018-04-05 16:10:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-05 16:10:54 (GMT) |
commit | 74b76d30105c74245628ebfa20148983fa0fc3d5 (patch) | |
tree | d47e574b05b9d5782cf353409b6e0b4b7bc91ed9 /src/disk_interface.cc | |
parent | 4494d38c590ede0dd270fe247b2dae80d97fc855 (diff) | |
parent | 6c864097ef11da366fb4070e6ab9f34d6a293766 (diff) | |
download | Ninja-74b76d30105c74245628ebfa20148983fa0fc3d5.zip Ninja-74b76d30105c74245628ebfa20148983fa0fc3d5.tar.gz Ninja-74b76d30105c74245628ebfa20148983fa0fc3d5.tar.bz2 |
Merge pull request #1365 from moroten/fix-disk-interface-tests-64-bit-timestamp
Fix disk_interface_test.cc on Windows for 64-bit timestamp
Diffstat (limited to 'src/disk_interface.cc')
-rw-r--r-- | src/disk_interface.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/disk_interface.cc b/src/disk_interface.cc index aceb575..f0f6346 100644 --- a/src/disk_interface.cc +++ b/src/disk_interface.cc @@ -105,13 +105,19 @@ bool StatAllFilesInDir(const string& dir, map<string, TimeStamp>* stamps, if (find_handle == INVALID_HANDLE_VALUE) { DWORD win_err = GetLastError(); - if (win_err == ERROR_FILE_NOT_FOUND || win_err == ERROR_PATH_NOT_FOUND) + if (win_err == ERROR_FILE_NOT_FOUND || win_err == ERROR_PATH_NOT_FOUND || + win_err == ERROR_DIRECTORY) // File and not a directory return true; *err = "FindFirstFileExA(" + dir + "): " + GetLastErrorString(); return false; } 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 +170,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); |