Fix config lookup ENOTDIR and prepare v0.1.4

This commit is contained in:
vrubelroman 2026-04-24 15:44:07 +03:00
parent 6b23717572
commit 87f43e0c6a
3 changed files with 15 additions and 10 deletions

View file

@ -6,6 +6,7 @@ import (
"os"
"path/filepath"
"strings"
"syscall"
toml "github.com/pelletier/go-toml/v2"
)
@ -247,7 +248,7 @@ func resolvePath(explicitPath string) (string, bool, error) {
}
if _, err := os.Stat(absPath); err == nil {
return absPath, true, nil
} else if !errors.Is(err, os.ErrNotExist) {
} else if !isMissingPathError(err) {
return "", false, fmt.Errorf("stat %s: %w", absPath, err)
}
}
@ -255,6 +256,10 @@ func resolvePath(explicitPath string) (string, bool, error) {
return "", false, nil
}
func isMissingPathError(err error) bool {
return errors.Is(err, os.ErrNotExist) || errors.Is(err, syscall.ENOTDIR)
}
func DefaultUserPath() (string, error) {
homeDir, err := os.UserHomeDir()
if err != nil {