Commit 4bd0ec6
fix: resolve executable path via _NSGetExecutablePath, not argv[0]
Bare-name PATH invocation (e.g. `afm` from any shell) sets
CommandLine.arguments[0] to "afm", which URL(fileURLWithPath:) treats
as relative to the CWD. The metallib search and webui search both
walked the wrong base directory, so Homebrew installs failed with
"MLX metallib not found" whenever invoked without a full path.
Switch both lookups to _NSGetExecutablePath, which goes through the
Mach-O loader and returns the true absolute path regardless of how
the binary was invoked. Bundle.main.executableURL and argv[0] remain
as fallbacks.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 4cbbe06 commit 4bd0ec6
2 files changed
Lines changed: 44 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
916 | 917 | | |
917 | 918 | | |
918 | 919 | | |
919 | | - | |
920 | | - | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
921 | 924 | | |
922 | | - | |
923 | | - | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
924 | 936 | | |
925 | | - | |
| 937 | + | |
926 | 938 | | |
927 | 939 | | |
928 | 940 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
8 | 34 | | |
9 | 35 | | |
10 | 36 | | |
| |||
14 | 40 | | |
15 | 41 | | |
16 | 42 | | |
17 | | - | |
| 43 | + | |
18 | 44 | | |
19 | 45 | | |
20 | 46 | | |
| |||
0 commit comments