Improve local shell CWD setting (#4396)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-11-23 08:35:16 -05:00
1 parent 8f84f394fe
commit 7c5a0a9a6d
7 files changed
+422 -120

No files matched your search

+7 -3
View File
@@ -22,9 +22,13 @@
import path from "path";
import os from "os";
function resolveTilde(filePath: string) {
if (filePath[0] === "~" && (filePath[1] === "/" || filePath.length === 1)) {
return filePath.replace("~", os.homedir());
export function resolveTilde(filePath: string) {
if (filePath === "~") {
return os.homedir();
}
if (filePath.startsWith("~/")) {
return `${os.homedir()}${filePath.slice(1)}`;
}
return filePath;