Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/path.js')
-rw-r--r--lib/path.js60
1 files changed, 10 insertions, 50 deletions
diff --git a/lib/path.js b/lib/path.js
index 000dd2359d6..cad86ab9a21 100644
--- a/lib/path.js
+++ b/lib/path.js
@@ -439,57 +439,17 @@ const win32 = {
if (len === 0)
return false;
var code = path.charCodeAt(0);
- if (len > 1) {
- if (code === 47/*/*/ || code === 92/*\*/) {
- // Possible UNC root
-
- code = path.charCodeAt(1);
- if (code === 47/*/*/ || code === 92/*\*/) {
- // Matched double path separator at beginning
- var j = 2;
- var last = j;
- // Match 1 or more non-path separators
- for (; j < len; ++j) {
- code = path.charCodeAt(j);
- if (code === 47/*/*/ || code === 92/*\*/)
- break;
- }
- if (j < len && j !== last) {
- // Matched!
- last = j;
- // Match 1 or more path separators
- for (; j < len; ++j) {
- code = path.charCodeAt(j);
- if (code !== 47/*/*/ && code !== 92/*\*/)
- break;
- }
- if (j < len && j !== last) {
- // Matched!
- last = j;
- // Match 1 or more non-path separators
- for (; j < len; ++j) {
- code = path.charCodeAt(j);
- if (code === 47/*/*/ || code === 92/*\*/)
- break;
- }
- if (j !== last)
- return true;
- }
- }
- }
- } else if ((code >= 65/*A*/ && code <= 90/*Z*/) ||
- (code >= 97/*a*/ && code <= 122/*z*/)) {
- // Possible device root
-
- code = path.charCodeAt(1);
- if (path.charCodeAt(1) === 58/*:*/ && len > 2) {
- code = path.charCodeAt(2);
- if (code === 47/*/*/ || code === 92/*\*/)
- return true;
- }
- }
- } else if (code === 47/*/*/ || code === 92/*\*/) {
+ if (code === 47/*/*/ || code === 92/*\*/) {
return true;
+ } else if ((code >= 65/*A*/ && code <= 90/*Z*/) ||
+ (code >= 97/*a*/ && code <= 122/*z*/)) {
+ // Possible device root
+
+ if (len > 2 && path.charCodeAt(1) === 58/*:*/) {
+ code = path.charCodeAt(2);
+ if (code === 47/*/*/ || code === 92/*\*/)
+ return true;
+ }
}
return false;
},