37
*/
38
export function extractCdPrefix(commandLine: string, isPowerShell: boolean): IExtractedCdPrefix | undefined {
40
>
isPowerShell
41
? /^(?:cd(?: \/d)?|Set-Location(?: -Path)?) (?<dir>"[^"]*"|[^\s]+) *(?:&&|;|\r?\n)\s*(?<suffix>[\s\S]+)$/i
42
: /^cd (?<dir>"[^"]*"|[^\s]+) *(?:&&|\r?\n)\s*(?<suffix>[\s\S]+)$/
44
>
const cdDir = cdPrefixMatch?.groups?.dir;
45
>
const cdSuffix = cdPrefixMatch?.groups?.suffix;
46
>
if (cdDir && cdSuffix) {
47
let cdDirPath = cdDir;
48
if (cdDirPath.startsWith('"') && cdDirPath.endsWith('"')) {