Skip to content

Commit

Permalink
Merge pull request #77 from webpack/bugfix/fallback-no-mtime
Browse files Browse the repository at this point in the history
returned mtime shouldn't be zero
  • Loading branch information
sokra committed Apr 26, 2018
2 parents 886039b + c9a64da commit d795456
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/DirectoryWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ DirectoryWatcher.prototype.onFileAdded = function onFileAdded(filePath, stat) {
if(filePath.indexOf(this.path) !== 0) return;
if(/[\\\/]/.test(filePath.substr(this.path.length + 1))) return;

this.setFileTime(filePath, +stat.mtime, false, "add");
this.setFileTime(filePath, +stat.mtime || +stat.ctime || 1, false, "add");
};

DirectoryWatcher.prototype.onDirectoryAdded = function onDirectoryAdded(directoryPath /*, stat */) {
Expand All @@ -259,7 +259,7 @@ DirectoryWatcher.prototype.onDirectoryAdded = function onDirectoryAdded(director
DirectoryWatcher.prototype.onChange = function onChange(filePath, stat) {
if(filePath.indexOf(this.path) !== 0) return;
if(/[\\\/]/.test(filePath.substr(this.path.length + 1))) return;
var mtime = +stat.mtime;
var mtime = +stat.mtime || +stat.ctime || 1;
ensureFsAccuracy(mtime);
this.setFileTime(filePath, mtime, false, "change");
};
Expand Down Expand Up @@ -309,7 +309,7 @@ DirectoryWatcher.prototype.doInitialScan = function doInitialScan() {
}
if(stat.isFile()) {
if(!this.files[itemPath])
this.setFileTime(itemPath, +stat.mtime, true);
this.setFileTime(itemPath, +stat.mtime || +stat.ctime || 1, true);
} else if(stat.isDirectory()) {
if(!this.directories[itemPath])
this.setDirectory(itemPath, true, true);
Expand Down

0 comments on commit d795456

Please sign in to comment.