diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-13 22:52:46 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-13 22:52:46 +0200 |
| commit | cd5a3614baab756a41d764b79308afeea93f12dd (patch) | |
| tree | efc8c31e8b162ca2121ba92c841322119e6d3b04 /internal/app/script.go | |
| parent | bf7c6ade292a6444877797c8d699d147aceb57cc (diff) | |
Remove Perl version and build files; add .gitignore for .serena/
Amp-Thread-ID: https://ampcode.com/threads/T-019c58b3-06fb-733d-8fc1-f268fe7f70d5
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'internal/app/script.go')
| -rw-r--r-- | internal/app/script.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/app/script.go b/internal/app/script.go new file mode 100644 index 0000000..2701cb2 --- /dev/null +++ b/internal/app/script.go @@ -0,0 +1,29 @@ +package app + +import ( + "os" + "path/filepath" +) + +// ScriptPath returns the path to the loadbars-remote.sh script. +// It looks for scripts/loadbars-remote.sh relative to the executable, then current dir. +func ScriptPath() string { + exe, err := os.Executable() + if err == nil { + dir := filepath.Dir(exe) + // When installed: exe is /usr/bin/loadbars, script might be /usr/share/loadbars/scripts/ + for _, sub := range []string{"scripts/loadbars-remote.sh", "../scripts/loadbars-remote.sh", "../../scripts/loadbars-remote.sh"} { + p := filepath.Join(dir, sub) + if _, err := os.Stat(p); err == nil { + return p + } + } + } + // Development: run from repo root + if p, err := filepath.Abs("scripts/loadbars-remote.sh"); err == nil { + if _, err := os.Stat(p); err == nil { + return p + } + } + return "scripts/loadbars-remote.sh" +} |
