(aPath: string, uppercaseDriveLetter = false)
| 150 | * Ensure lower case drive letter and \ on Windows |
| 151 | */ |
| 152 | export function fixDriveLetterAndSlashes(aPath: string, uppercaseDriveLetter = false): string { |
| 153 | if (!aPath) return aPath; |
| 154 | |
| 155 | aPath = fixDriveLetter(aPath, uppercaseDriveLetter); |
| 156 | if (aPath.match(/file:\/\/\/[A-Za-z]:/)) { |
| 157 | const prefixLen = 'file:///'.length; |
| 158 | aPath = aPath.substr(0, prefixLen + 1) + aPath.substr(prefixLen + 1).replace(/\//g, '\\'); |
| 159 | } else if (isWindowsPath(aPath)) { |
| 160 | aPath = aPath.replace(/\//g, '\\'); |
| 161 | } |
| 162 | |
| 163 | return aPath; |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * Replace any backslashes with forward slashes |
no test coverage detected