execute_tool: resolve tools from $OLLIE/t

ToolsPath() fell back to ~/.config/ollie/tools when OLLIE_TOOLS_PATH
was unset, ignoring the 9P mount entirely. Add /home/lkn/mnt/ollie/t as the
preferred fallback so execute_tool finds tools on the mounted
filesystem regardless of cwd.
This commit is contained in:
Levi Neely 2026-04-15 11:12:53 +02:00
parent 5582f3c8de
commit 42b7b5b5c2
1 changed files with 5 additions and 2 deletions

View File

@ -1,7 +1,7 @@
package execute
// execute_tool is a specific case of execute_code, such that the name of the
// script passed to `tool` is loaded into memory from `$OLLIE_9MOUNT/t/` and
// script passed to `tool` is loaded into memory from `$OLLIE/t/` and
// run with Execute(...).
import (
@ -15,7 +15,7 @@ import (
// ToolsPath returns the directory to search for named tool scripts.
// Resolved in order: first entry of OLLIE_TOOLS_PATH (colon-separated),
// then ~/.config/ollie/tools.
// then $OLLIE/t.
func ToolsPath() string {
if p := os.Getenv("OLLIE_TOOLS_PATH"); p != "" {
if i := strings.Index(p, ":"); i >= 0 {
@ -23,6 +23,9 @@ func ToolsPath() string {
}
return p
}
if p := os.Getenv("OLLIE"); p != "" {
return filepath.Join(p, "t")
}
home, _ := os.UserHomeDir()
return filepath.Join(home, ".config", "ollie", "tools")
}