2023-05-06 20:18:22 +00:00
|
|
|
//go:build !linux
|
|
|
|
// +build !linux
|
2022-02-21 01:40:38 +00:00
|
|
|
|
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/user"
|
|
|
|
"path/filepath"
|
|
|
|
)
|
|
|
|
|
|
|
|
// DefaultConfigPath returns a sensible default configuration file path.
|
|
|
|
func DefaultConfigPath(dir, base string) string {
|
|
|
|
user, err := user.Current()
|
|
|
|
if err != nil || user.HomeDir == "" {
|
|
|
|
return filepath.Join(dir, base)
|
|
|
|
}
|
|
|
|
|
|
|
|
return filepath.Join(user.HomeDir, dir, base)
|
|
|
|
}
|