MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / findDefaultConfigPathForOS

Function findDefaultConfigPathForOS

internal/config/files.go:83–103  ·  view source on GitHub ↗
(goos string)

Source from the content-addressed store, hash-verified

81}
82
83func findDefaultConfigPathForOS(goos string) (string, bool) {
84 const windowsOS = "windows"
85 configPath := filepath.Join(getConfigDirForOS(goos), "config.yml")
86 if _, err := os.Stat(configPath); err == nil {
87 return configPath, true
88 }
89
90 if goos == windowsOS {
91 xdgPath := filepath.Join(getXDGBaseConfigDir(), "pvetui", "config.yml")
92 if _, err := os.Stat(xdgPath); err == nil {
93 return xdgPath, true
94 }
95 }
96
97 // Check for config in current directory
98 if _, err := os.Stat("config.yml"); err == nil {
99 return "config.yml", true
100 }
101
102 return "", false
103}
104
105// getConfigDir returns the appropriate config directory path for the current platform.
106func getConfigDir() string {

Calls 2

getConfigDirForOSFunction · 0.85
getXDGBaseConfigDirFunction · 0.85