Skip to content

Commit

Permalink
Ensure all comparisons within rebaseRelativePath handle Windows pat…
Browse files Browse the repository at this point in the history
…hs (as in #23)
  • Loading branch information
brettz9 committed Mar 20, 2017
1 parent 8d9d385 commit 8615778
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ var protocolRx = /^[a-z]+:\/\//;
/**
* Rebases a relative path in 'sourceFile' to be relative
* to the path where 'sourceFile' is located.
*
*
* This is necessary before adding relative paths to the
* new combined map to ensure all paths are relative to their
* original source.
*
*
* The 'sourceRoot' from the original source map is joined
* as well to ensure the complete path.
*
Expand All @@ -32,7 +32,9 @@ var rebaseRelativePath = memoize(function(sourceFile, relativeRoot, relativePath
}

// join relative path to root (e.g. 'src/' + 'file.js')
var relativeRootedPath = relativeRoot ? path.join(relativeRoot, relativePath).replace(/\\/g, '/') : relativePath;
var relativeRootedPath = relativeRoot ? path.join(relativeRoot, relativePath) : relativePath;
relativeRootedPath = relativeRootedPath.replace(/\\/g, '/');
sourceFile = sourceFile.replace(/\\/g, '/');

if (sourceFile === relativeRootedPath || // same path,
pathIsAbsolute(relativeRootedPath) || // absolute path, nor
Expand Down

0 comments on commit 8615778

Please sign in to comment.