export function getCDCommand()

in src/Utils/VSCodeUI.ts [43:59]


export function getCDCommand(cwd: string): string {
    if (os.platform() === "win32") {
        const windowsShell: string = workspace.getConfiguration("terminal").get<string>("integrated.shell.windows")
            .toLowerCase();
        if (windowsShell && windowsShell.indexOf("bash.exe") > -1 && windowsShell.indexOf("git") > -1) {
            return `cd "${cwd.replace(/\\+$/, "")}"`; // Git Bash: remove trailing '\'
        } else if (windowsShell && windowsShell.indexOf("powershell.exe") > -1) {
            return `cd "${cwd}"`; // PowerShell
        } else if (windowsShell && windowsShell.indexOf("cmd.exe") > -1) {
            return `cd /d "${cwd}"`; // CMD
        } else {
            return `cd "${cwd}"`; // Unknown, try using common one.
        }
    } else {
        return `cd "${cwd}"`;
    }
}