fortrangoingonforty/fortress / 21e301c

Browse files

Fix shell integration to find fortress-bin in PATH (fixes Homebrew on macOS)

Authored by espadonne
SHA
21e301c1017385d83111c65546b7f52936a301ed
Parents
83b5c3e
Tree
33c9e20

2 changed files

StatusFile+-
M fortress.fish 9 3
M fortress.sh 5 2
fortress.fishmodified
@@ -7,11 +7,17 @@
77
 function fortress --description "Navigate filesystem with FORTRESS and cd on exit"
88
     # Set fortress directory - prefer system install, fallback to FORTRESS_DIR env var
99
     set -l fortress_dir
10
-    if set -q FORTRESS_DIR
11
-        set fortress_dir $FORTRESS_DIR
10
+    set -l fortress_exe
11
+
12
+    # Check for fortress-bin in PATH first (works for all package managers including Homebrew)
13
+    if command -v fortress-bin &> /dev/null
14
+        set fortress_exe fortress-bin
1215
     else if test -x /usr/bin/fortress-bin
13
-        # Use system-installed binary
16
+        # Use system-installed binary (RPM/AUR)
1417
         set fortress_exe /usr/bin/fortress-bin
18
+    else if set -q FORTRESS_DIR
19
+        set fortress_dir $FORTRESS_DIR
20
+        set fortress_exe $fortress_dir/build/gfortran_*/app/fortress
1521
     else
1622
         # Fallback to local development path
1723
         set fortress_dir $HOME/Documents/GithubOrgs/FortranGoingOnForty/fortress
fortress.shmodified
@@ -8,8 +8,11 @@ fortress() {
88
     # Determine which fortress binary to use
99
     local fortress_exe
1010
 
11
-    if [ -x "/usr/bin/fortress-bin" ]; then
12
-        # Use system-installed binary (via package manager)
11
+    # Check for fortress-bin in PATH first (works for all package managers including Homebrew)
12
+    if command -v fortress-bin &> /dev/null; then
13
+        fortress_exe="fortress-bin"
14
+    elif [ -x "/usr/bin/fortress-bin" ]; then
15
+        # Use system-installed binary (via package manager like RPM/AUR)
1316
         fortress_exe="/usr/bin/fortress-bin"
1417
     elif [ -n "$FORTRESS_DIR" ]; then
1518
         # Use FORTRESS_DIR if set