Skip to content

Commit

Permalink
Fixed a minor issue with absolute paths on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
cowboy committed Mar 28, 2012
1 parent 15cf17f commit 2b86c72
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/glob.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ exports.glob = function(pattern, options) {
var absPattern = normalize(path.resolve(base, pattern)); var absPattern = normalize(path.resolve(base, pattern));
// Since path.resolve strips off trailing '/', add it back if necessary. // Since path.resolve strips off trailing '/', add it back if necessary.
if (/\/$/.test(pattern)) { absPattern += '/'; } if (/\/$/.test(pattern)) { absPattern += '/'; }
// Was pattern-ass-specified already absolute? // Was pattern-as-specified already absolute?
var wasAbsolute = pattern === absPattern; var wasAbsolute = normalize(pattern) === absPattern;
// Instead of recursing from the base looking for files, start recursing at // Instead of recursing from the base looking for files, start recursing at
// the farthest possible subdirectory that doesn't contain any kind of // the farthest possible subdirectory that doesn't contain any kind of
// wildcard characters. I may have missed one, so let me know if I have! // wildcard characters. I may have missed one, so let me know if I have!
Expand Down
2 changes: 1 addition & 1 deletion test/glob_test.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function normalize(filepath) {
} }


function makeAbsolute(filepath) { function makeAbsolute(filepath) {
var abspath = normalize(path.resolve(process.cwd(), filepath)); var abspath = path.resolve(process.cwd(), filepath);
if (/\/$/.test(filepath)) { abspath += '/'; } if (/\/$/.test(filepath)) { abspath += '/'; }
return abspath; return abspath;
} }
Expand Down

0 comments on commit 2b86c72

Please sign in to comment.