Release 2.7.1: fix macOS DMG launch, cores path and naive download.
Use UDZO DMG via hdiutil, store cores under Application Support, and match new naiveproxy mac asset names. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -207,11 +207,15 @@ func (c *Config) ActiveProfile() (*Profile, error) {
|
||||
}
|
||||
|
||||
// ResolveBinDir returns an absolute bin directory.
|
||||
// Relative paths are resolved next to the executable (portable install layout).
|
||||
// Relative paths are resolved next to the executable (portable install layout),
|
||||
// or under ~/Library/Application Support/Navis on macOS (.app bundles are read-only).
|
||||
func ResolveBinDir(cfgPath, binDir string) (string, error) {
|
||||
if filepath.IsAbs(binDir) {
|
||||
return binDir, nil
|
||||
}
|
||||
if dir, ok := platformNavisDir(); ok {
|
||||
return filepath.Abs(filepath.Join(dir, binDir))
|
||||
}
|
||||
if exe, err := os.Executable(); err == nil {
|
||||
return filepath.Abs(filepath.Join(filepath.Dir(exe), binDir))
|
||||
}
|
||||
@@ -283,9 +287,16 @@ func (c *Config) SetActiveProxy(proxy string) error {
|
||||
return fmt.Errorf("active profile %q not found", c.Active)
|
||||
}
|
||||
|
||||
// LocateConfig finds configs/config.json next to the executable or in cwd.
|
||||
// LocateConfig finds configs/config.json next to the executable, in cwd,
|
||||
// or under ~/Library/Application Support/Navis on macOS.
|
||||
func LocateConfig() (string, error) {
|
||||
candidates := []string{}
|
||||
if dir, ok := platformNavisDir(); ok {
|
||||
candidates = append(candidates,
|
||||
filepath.Join(dir, "configs", "config.json"),
|
||||
filepath.Join(dir, "config.json"),
|
||||
)
|
||||
}
|
||||
if exe, err := os.Executable(); err == nil {
|
||||
dir := filepath.Dir(exe)
|
||||
candidates = append(candidates,
|
||||
@@ -301,6 +312,9 @@ func LocateConfig() (string, error) {
|
||||
return p, nil
|
||||
}
|
||||
}
|
||||
if dir, ok := platformNavisDir(); ok {
|
||||
return filepath.Join(dir, "configs", "config.json"), nil
|
||||
}
|
||||
// Default path next to executable for first-run create.
|
||||
if exe, err := os.Executable(); err == nil {
|
||||
return filepath.Join(filepath.Dir(exe), "configs", "config.json"), nil
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//go:build darwin
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func platformNavisDir() (string, bool) {
|
||||
base, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
return "", false
|
||||
}
|
||||
return filepath.Join(base, "Navis"), true
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//go:build !darwin
|
||||
|
||||
package config
|
||||
|
||||
func platformNavisDir() (string, bool) {
|
||||
return "", false
|
||||
}
|
||||
Reference in New Issue
Block a user