Skip to content

Commit 12e39f0

Browse files
committed
Make fish commands conditional on SWIFTLY_HOME_DIR
Correct the default Linux swiftly home paths
1 parent 21894b2 commit 12e39f0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

_includes/install/_linux_platforms_tabs.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ function setShell() {
2424

2525
if (shell == "sh") {
2626
shell = "fish";
27-
code.innerText += ". ~/.swiftly/env.fish"
27+
code.innerText = code.innerText.replace("$(", "(") // Subshells are invoked differently in fish
28+
code.innerText = code.innerText.replace("$(", "(")
29+
code.innerText += "set -q SWIFTLY_HOME_DIR && . \"$SWIFTLY_HOME_DIR/env.fish\" || . ~/.local/share/swiftly/env.fish"
2830
shellToggle.innerText = "sh";
2931
} else {
3032
shell = "sh";
31-
code.innerText += ". ${SWIFTLY_HOME_DIR:-~/.swiftly}/env.sh && \\\n"
33+
code.innerText += ". ${SWIFTLY_HOME_DIR:-~/.local/share/swiftly}/env.sh && \\\n"
3234
code.innerText += "hash -r"
3335
shellToggle.innerText = "fish";
3436
}

install/macos/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function setShell() {
4040

4141
if (shell == "sh") {
4242
shell = "fish";
43-
code.innerText += ". ~/.swiftly/env.fish"
43+
code.innerText += "set -q SWIFTLY_HOME_DIR && . \"$SWIFTLY_HOME_DIR/env.fish\" || . ~/.swiftly/env.fish"
4444
shellToggle.innerText = "sh";
4545
} else {
4646
shell = "sh";

0 commit comments

Comments
 (0)