discover: fix default LibOllamaPath value (#8702)
This commit is contained in:
parent
711648c9bb
commit
5d75d837ef
@ -24,12 +24,14 @@ var LibOllamaPath string = func() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
libPath := filepath.Dir(exe)
|
var libPath string
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "windows":
|
case "windows":
|
||||||
libPath = filepath.Join(filepath.Dir(exe), "lib", "ollama")
|
libPath = filepath.Join(filepath.Dir(exe), "lib", "ollama")
|
||||||
case "linux":
|
case "linux":
|
||||||
libPath = filepath.Join(filepath.Dir(exe), "..", "lib", "ollama")
|
libPath = filepath.Join(filepath.Dir(exe), "..", "lib", "ollama")
|
||||||
|
case "darwin":
|
||||||
|
libPath = filepath.Dir(exe)
|
||||||
}
|
}
|
||||||
|
|
||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
@ -37,17 +39,19 @@ var LibOllamaPath string = func() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
paths := []string{
|
||||||
|
libPath,
|
||||||
|
|
||||||
// build paths for development
|
// build paths for development
|
||||||
buildPaths := []string{
|
|
||||||
filepath.Join(filepath.Dir(exe), "build", "lib", "ollama"),
|
filepath.Join(filepath.Dir(exe), "build", "lib", "ollama"),
|
||||||
filepath.Join(cwd, "build", "lib", "ollama"),
|
filepath.Join(cwd, "build", "lib", "ollama"),
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range buildPaths {
|
for _, p := range paths {
|
||||||
if _, err := os.Stat(p); err == nil {
|
if _, err := os.Stat(p); err == nil {
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return libPath
|
return filepath.Dir(exe)
|
||||||
}()
|
}()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user