pathwatcher
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -34,2 +34,5 @@ (function() { | ||
})(this)); | ||
if (fs.isCaseInsensitive()) { | ||
this.lowerCasePath = this.path.toLowerCase(); | ||
} | ||
} | ||
@@ -50,5 +53,11 @@ | ||
this.realPath = fs.realpathSync(this.path); | ||
if (fs.isCaseInsensitive()) { | ||
this.lowerCaseRealPath = this.realPath.toLowerCase(); | ||
} | ||
} catch (_error) { | ||
e = _error; | ||
this.realPath = this.path; | ||
if (fs.isCaseInsensitive()) { | ||
this.lowerCaseRealPath = this.lowerCasePath; | ||
} | ||
} | ||
@@ -60,15 +69,29 @@ } | ||
Directory.prototype.contains = function(pathToCheck) { | ||
var directoryPath, fullPath; | ||
if (!pathToCheck) { | ||
return false; | ||
} | ||
if (pathToCheck.indexOf(path.join(this.getPath(), path.sep)) === 0) { | ||
if (process.platform === 'win32') { | ||
fullPath = fullPath.replace(/\//g, '\\'); | ||
} | ||
if (fs.isCaseInsensitive()) { | ||
directoryPath = this.lowerCasePath; | ||
pathToCheck = pathToCheck.toLowerCase(); | ||
} else { | ||
directoryPath = this.path; | ||
} | ||
if (this.isPathPrefixOf(directoryPath, pathToCheck)) { | ||
return true; | ||
} else if (pathToCheck.indexOf(path.join(this.getRealPathSync(), path.sep)) === 0) { | ||
return true; | ||
} | ||
this.getRealPathSync(); | ||
if (fs.isCaseInsensitive()) { | ||
directoryPath = this.lowerCaseRealPath; | ||
} else { | ||
return false; | ||
directoryPath = this.realPath; | ||
} | ||
return this.isPathPrefixOf(directoryPath, pathToCheck); | ||
}; | ||
Directory.prototype.relativize = function(fullPath) { | ||
var directoryPath, pathToCheck; | ||
if (!fullPath) { | ||
@@ -80,10 +103,24 @@ return fullPath; | ||
} | ||
if (fullPath === this.getPath()) { | ||
if (fs.isCaseInsensitive()) { | ||
pathToCheck = fullPath.toLowerCase(); | ||
directoryPath = this.lowerCasePath; | ||
} else { | ||
pathToCheck = fullPath; | ||
directoryPath = this.path; | ||
} | ||
if (pathToCheck === directoryPath) { | ||
return ''; | ||
} else if (this.isPathPrefixOf(this.getPath(), fullPath)) { | ||
return fullPath.substring(this.getPath().length + 1); | ||
} else if (fullPath === this.getRealPathSync()) { | ||
} else if (this.isPathPrefixOf(directoryPath, pathToCheck)) { | ||
return fullPath.substring(directoryPath.length + 1); | ||
} | ||
this.getRealPathSync(); | ||
if (fs.isCaseInsensitive()) { | ||
directoryPath = this.lowerCaseRealPath; | ||
} else { | ||
directoryPath = this.realPath; | ||
} | ||
if (pathToCheck === directoryPath) { | ||
return ''; | ||
} else if (this.isPathPrefixOf(this.getRealPathSync(), fullPath)) { | ||
return fullPath.substring(this.getRealPathSync().length + 1); | ||
} else if (this.isPathPrefixOf(directoryPath, pathToCheck)) { | ||
return fullPath.substring(directoryPath.length + 1); | ||
} else { | ||
@@ -90,0 +127,0 @@ return fullPath; |
@@ -5,3 +5,3 @@ { | ||
"description": "Watch file events", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"licenses": [ | ||
@@ -34,3 +34,3 @@ { | ||
"grunt-coffeelint": "0.0.6", | ||
"temp": "0.6.0" | ||
"temp": "~0.7.0" | ||
}, | ||
@@ -43,3 +43,3 @@ "dependencies": { | ||
"underscore-plus": "~1.x", | ||
"fs-plus": "~2.x", | ||
"fs-plus": "^2.1", | ||
"async": "~0.2.10", | ||
@@ -46,0 +46,0 @@ "runas": "~0.5.3" |
@@ -1,2 +0,2 @@ | ||
# Path Watcher Node Module [![Build Status](https://travis-ci.org/atom/node-pathwatcher.png?branch=master)](https://travis-ci.org/atom/node-pathwatcher) | ||
# Path Watcher Node Module [![Build Status](https://travis-ci.org/atom/node-pathwatcher.svg?branch=master)](https://travis-ci.org/atom/node-pathwatcher) | ||
@@ -3,0 +3,0 @@ ## Installing |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48808
569
Updatedfs-plus@^2.1