From 0a5b548260f6aade177092c967bf490d65ffd47f Mon Sep 17 00:00:00 2001 From: isaacs Date: Thu, 15 Dec 2011 08:04:15 -0800 Subject: [PATCH] Get absolute paths properly for windows --- lib/utils/relativize.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/utils/relativize.js b/lib/utils/relativize.js index 74c45c5d3e5..70f2032069c 100644 --- a/lib/utils/relativize.js +++ b/lib/utils/relativize.js @@ -30,7 +30,18 @@ var split = process.platform === "win32" ? /[\/\\]/ : "/" function isAbsolute (p) { if (process.platform !== "win32") return p.charAt(0) === "/" - return path.resolve(p) === p + + + // yanked from node/lib/path.js + var splitDeviceRe = + /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?([\s\S]*?)$/ + + var result = p.match(splitDeviceRe) + , device = result[1] || "" + , isUnc = device && device.charAt(1) !== ":" + , isAbs = !!result[2] || isUnc // UNC always absolute + + return isAbs } if (module === require.main) {