src/vs/css.build.ts/CSSPluginUtilities/joinPaths
class CSSPluginUtilities:	public static joinPaths(a: string, b: string): string {

		function findSlashIndexAfterPrefix(haystack: string, prefix: string): number {
			if (CSSPluginUtilities.startsWith(haystack, prefix)) {
				return Math.max(prefix.length, haystack.indexOf('/', prefix.length));
			}
			return 0;
		}

		let aPathStartIndex = 0;
		aPathStartIndex = aPathStartIndex || findSlashIndexAfterPrefix(a, '//');
		aPathStartIndex = aPathStartIndex || findSlashIndexAfterPrefix(a, 'http://');
		aPathStartIndex = aPathStartIndex || findSlashIndexAfterPrefix(a, 'https://');

		function pushPiece(pieces: string[], piece: string): void {
			if (piece === './') {
				// Ignore
				return;
			}
			if (piece === '../') {
				const prevPiece = (pieces.length > 0 ? pieces[pieces.length - 1] : null);
				if (prevPiece && prevPiece === '/') {
					// Ignore
					return;
				}
				if (prevPiece && prevPiece !== '../') {
					// Pop
					pieces.pop();
					return;
				}
			}
			// Push
			pieces.push(piece);
		}

		function push(pieces: string[], path: string): void {
			while (path.length > 0) {
				const slashIndex = path.indexOf('/');
				const piece = (slashIndex >= 0 ? path.substring(0, slashIndex + 1) : path);
				path = (slashIndex >= 0 ? path.substring(slashIndex + 1) : '');
				pushPiece(pieces, piece);
			}
		}

		let pieces: string[] = [];
		push(pieces, a.substr(aPathStartIndex));
		if (b.length > 0 && b.charAt(0) === '/') {
			pieces = [];
		}
		push(pieces, b);

		return a.substring(0, aPathStartIndex) + pieces.join('');
	}