diff options
Diffstat (limited to 'lib/path.js')
-rw-r--r-- | lib/path.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/path.js b/lib/path.js index 0ca51e84f3..148b2af9a1 100644 --- a/lib/path.js +++ b/lib/path.js @@ -62,7 +62,8 @@ if (isWindows) { /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?([\s\S]*?)$/; // Regex to split the tail part of the above into [*, dir, basename, ext] - var splitTailRe = /^([\s\S]+[\\\/](?!$)|[\\\/])?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/\\]*)?)$/; + var splitTailRe = + /^([\s\S]+[\\\/](?!$)|[\\\/])?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/\\]*)?)$/; // Function to split a filename into [root, dir, basename, ext] // windows version @@ -262,7 +263,8 @@ if (isWindows) { // Split a filename into [root, dir, basename, ext], unix version // 'root' is just a slash, or nothing. - var splitPathRe = /^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/; + var splitPathRe = + /^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/; var splitPath = function(filename) { var result = splitPathRe.exec(filename); return [result[1] || '', result[2] || '', result[3] || '', result[4] || '']; @@ -420,11 +422,11 @@ exports.existsSync = function(path) { module.deprecate('existsSync', 'It is now called `fs.existsSync`.'); -exports._makeLong = isWindows ? - function(path) { - path = "" + path; +if (isWindows) { + exports._makeLong = function(path) { + path = '' + path; if (!path) { - return ""; + return ''; } var resolvedPath = exports.resolve(path); @@ -440,7 +442,9 @@ exports._makeLong = isWindows ? } return path; - } : - function(path) { + }; +} else { + exports._makeLong = function(path) { return path; }; +} |