resolver/path.js
function relative(from, to) {
		assertPath(from);
		assertPath(to);

		if (from === to) return '';

		var fromOrig = win32.resolve(from);
		var toOrig = win32.resolve(to);

		if (fromOrig === toOrig) return '';

		from = fromOrig.toLowerCase();
		to = toOrig.toLowerCase();

		if (from === to) return '';

		// Trim any leading backslashes
		var fromStart = 0;
		for (; fromStart < from.length; ++fromStart) {
			if (from.charCodeAt(fromStart) !== 92 /*\*/) break;
		}
		// Trim trailing backslashes (applicable to UNC paths only)
		var fromEnd = from.length;
		for (; fromEnd - 1 > fromStart; --fromEnd) {
			if (from.charCodeAt(fromEnd - 1) !== 92 /*\*/) break;
		}
		var fromLen = fromEnd - fromStart;

		// Trim any leading backslashes
		var toStart = 0;
		for (; toStart < to.length; ++toStart) {
			if (to.charCodeAt(toStart) !== 92 /*\*/) break;
		}
		// Trim trailing backslashes (applicable to UNC paths only)
		var toEnd = to.length;
		for (; toEnd - 1 > toStart; --toEnd) {
			if (to.charCodeAt(toEnd - 1) !== 92 /*\*/) break;
		}
		var toLen = toEnd - toStart;

		// Compare paths to find the longest common path from root
		var length = fromLen < toLen ? fromLen : toLen;
		var lastCommonSep = -1;
		var i = 0;
		for (; i <= length; ++i) {
			if (i === length) {
				if (toLen > length) {
					if (to.charCodeAt(toStart + i) === 92 /*\*/) {
							// We get here if `from` is the exact base path for `to`.
							// For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz'
							return toOrig.slice(toStart + i + 1);
						} else if (i === 2) {
						// We get here if `from` is the device root.
						// For example: from='C:\\'; to='C:\\foo'
						return toOrig.slice(toStart + i);
					}
				}
				if (fromLen > length) {
					if (from.charCodeAt(fromStart + i) === 92 /*\*/) {
							// We get here if `to` is the exact base path for `from`.
							// For example: from='C:\\foo\\bar'; to='C:\\foo'
							lastCommonSep = i;
						} else if (i === 2) {
						// We get here if `to` is the device root.
						// For example: from='C:\\foo\\bar'; to='C:\\'
						lastCommonSep = 3;
					}
				}
				break;
			}
			var fromCode = from.charCodeAt(fromStart + i);
			var toCode = to.charCodeAt(toStart + i);
			if (fromCode !== toCode) break;else if (fromCode === 92 /*\*/) lastCommonSep = i;
		}

		// We found a mismatch before the first common path separator was seen, so
		// return the original `to`.
		// TODO: do this just for device roots (and not UNC paths)?
		if (i !== length && lastCommonSep === -1) {
			if (toStart > 0) return toOrig.slice(toStart);else return toOrig;
		}

		var out = '';
		if (lastCommonSep === -1) lastCommonSep = 0;
		// Generate the relative path based on the path difference between `to` and
		// `from`
		for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
			if (i === fromEnd || from.charCodeAt(i) === 92 /*\*/) {
					if (out.length === 0) out += '..';else out += '\\..';
				}
		}

		// Lastly, append the rest of the destination (`to`) path that comes after
		// the common path parts
		if (out.length > 0) return out + toOrig.slice(toStart + lastCommonSep, toEnd);else {
			toStart += lastCommonSep;
			if (toOrig.charCodeAt(toStart) === 92 /*\*/) ++toStart;
			return toOrig.slice(toStart, toEnd);
		}
	}
function relative(from, to) {
		assertPath(from);
		assertPath(to);

		if (from === to) return '';

		var fromOrig = win32.resolve(from);
		var toOrig = win32.resolve(to);

		if (fromOrig === toOrig) return '';

		from = fromOrig.toLowerCase();
		to = toOrig.toLowerCase();

		if (from === to) return '';

		// Trim any leading backslashes
		var fromStart = 0;
		for (; fromStart < from.length; ++fromStart) {
			if (from.charCodeAt(fromStart) !== 92 /*\*/) break;
		}
		// Trim trailing backslashes (applicable to UNC paths only)
		var fromEnd = from.length;
		for (; fromEnd - 1 > fromStart; --fromEnd) {
			if (from.charCodeAt(fromEnd - 1) !== 92 /*\*/) break;
		}
		var fromLen = fromEnd - fromStart;

		// Trim any leading backslashes
		var toStart = 0;
		for (; toStart < to.length; ++toStart) {
			if (to.charCodeAt(toStart) !== 92 /*\*/) break;
		}
		// Trim trailing backslashes (applicable to UNC paths only)
		var toEnd = to.length;
		for (; toEnd - 1 > toStart; --toEnd) {
			if (to.charCodeAt(toEnd - 1) !== 92 /*\*/) break;
		}
		var toLen = toEnd - toStart;

		// Compare paths to find the longest common path from root
		var length = fromLen < toLen ? fromLen : toLen;
		var lastCommonSep = -1;
		var i = 0;
		for (; i <= length; ++i) {
			if (i === length) {
				if (toLen > length) {
					if (to.charCodeAt(toStart + i) === 92 /*\*/) {
							// We get here if `from` is the exact base path for `to`.
							// For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz'
							return toOrig.slice(toStart + i + 1);
						} else if (i === 2) {
						// We get here if `from` is the device root.
						// For example: from='C:\\'; to='C:\\foo'
						return toOrig.slice(toStart + i);
					}
				}
				if (fromLen > length) {
					if (from.charCodeAt(fromStart + i) === 92 /*\*/) {
							// We get here if `to` is the exact base path for `from`.
							// For example: from='C:\\foo\\bar'; to='C:\\foo'
							lastCommonSep = i;
						} else if (i === 2) {
						// We get here if `to` is the device root.
						// For example: from='C:\\foo\\bar'; to='C:\\'
						lastCommonSep = 3;
					}
				}
				break;
			}
			var fromCode = from.charCodeAt(fromStart + i);
			var toCode = to.charCodeAt(toStart + i);
			if (fromCode !== toCode) break;else if (fromCode === 92 /*\*/) lastCommonSep = i;
		}

		// We found a mismatch before the first common path separator was seen, so
		// return the original `to`.
		// TODO: do this just for device roots (and not UNC paths)?
		if (i !== length && lastCommonSep === -1) {
			if (toStart > 0) return toOrig.slice(toStart);else return toOrig;
		}

		var out = '';
		if (lastCommonSep === -1) lastCommonSep = 0;
		// Generate the relative path based on the path difference between `to` and
		// `from`
		for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
			if (i === fromEnd || from.charCodeAt(i) === 92 /*\*/) {
					if (out.length === 0) out += '..';else out += '\\..';
				}
		}

		// Lastly, append the rest of the destination (`to`) path that comes after
		// the common path parts
		if (out.length > 0) return out + toOrig.slice(toStart + lastCommonSep, toEnd);else {
			toStart += lastCommonSep;
			if (toOrig.charCodeAt(toStart) === 92 /*\*/) ++toStart;
			return toOrig.slice(toStart, toEnd);
		}
	}
It will solve the relative path from `from` to `to`, for instance: from = 'C:\\orandea\\test\\aaa' to = 'C:\\orandea\\impl\\bbb' The output of the function should be: '..\\..\\impl\\bbb'