Permalink
Browse files

Fix prefix for windows azure

  • Loading branch information...
1 parent 325584a commit b5ba0430b012d93367a4f87c304f1d4c8c22941c Forbes Lindesay committed with substack Sep 18, 2013
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/node-modules-paths.js
View
@@ -3,6 +3,12 @@ var path = require('path');
module.exports = function (start, opts) {
var modules = opts.moduleDirectory || 'node_modules';
+ var prefix = '/';
+ if (/^([A-Za-z]:)/.test(start)) {
+ prefix = '';
+ } else if (/^\\\\/.test(start)) {
+ prefix = '\\\\';
+ }
var splitRe = process.platform === 'win32' ? /[\/\\]/ : /\/+/;
var parts = start.split(splitRe);
@@ -13,10 +19,7 @@ module.exports = function (start, opts) {
path.join.apply(path, parts.slice(0, i + 1)),
modules
);
- if (!parts[0].match(/([A-Za-z]:)/)) {
- dir = '/' + dir;
- }
- dirs.push(dir);
+ dirs.push(prefix + dir);
}
return dirs.concat(opts.paths);
}

0 comments on commit b5ba043

Please sign in to comment.