|
|
@ -1,5 +1,6 @@ |
|
|
|
'use strict'; |
|
|
|
import { createHash, HexBase64Latin1Encoding } from 'crypto'; |
|
|
|
import { isWindows } from '../git/shell'; |
|
|
|
|
|
|
|
const emptyStr = ''; |
|
|
|
|
|
|
@ -58,6 +59,7 @@ export namespace Strings { |
|
|
|
return secs * 1000 + Math.floor(nanosecs / 1000000); |
|
|
|
} |
|
|
|
|
|
|
|
const driveLetterNormalizeRegex = /(?<=^\/?)([A-Z])(?=:\/)/; |
|
|
|
const pathNormalizeRegex = /\\/g; |
|
|
|
const pathStripTrailingSlashRegex = /\/$/g; |
|
|
|
const tokenRegex = /\$\{(\W*)?([^|]*?)(?:\|(\d+)(-|\?)?)?(\W*)?\}/g; |
|
|
@ -149,6 +151,11 @@ export namespace Strings { |
|
|
|
normalized = `/${normalized}`; |
|
|
|
} |
|
|
|
|
|
|
|
if (isWindows) { |
|
|
|
// Ensure that drive casing is normalized (lower case)
|
|
|
|
normalized = normalized.replace(driveLetterNormalizeRegex, (drive: string) => drive.toLowerCase()); |
|
|
|
} |
|
|
|
|
|
|
|
return normalized; |
|
|
|
} |
|
|
|
|
|
|
|