also look at cwd as a root for windows runners (#3959)

This commit is contained in:
Jeffrey Morgan 2024-04-26 19:14:08 -04:00 committed by GitHub
parent ec1acbb867
commit aad8d128a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,9 +32,25 @@ func PayloadsDir() (string, error) {
slog.Error("failed to lookup executable path", "error", err) slog.Error("failed to lookup executable path", "error", err)
return "", err return "", err
} }
cwd, err := os.Getwd()
if err != nil {
slog.Error("failed to lookup working directory", "error", err)
return "", err
}
var paths []string
for _, root := range []string{appExe, cwd} {
paths = append(paths,
filepath.Join(root),
filepath.Join(root, "windows-"+runtime.GOARCH),
filepath.Join(root, "dist", "windows-"+runtime.GOARCH),
)
}
// Try a few variations to improve developer experience when building from source in the local tree // Try a few variations to improve developer experience when building from source in the local tree
for _, d := range []string{".", "windows-" + runtime.GOARCH, "dist\\windows-" + runtime.GOARCH} { for _, p := range paths {
candidate := filepath.Join(filepath.Dir(appExe), d, "ollama_runners") candidate := filepath.Join(p, "ollama_runners")
_, err := os.Stat(candidate) _, err := os.Stat(candidate)
if err == nil { if err == nil {
runnersDir = candidate runnersDir = candidate