Checkpoint

This commit is contained in:
maze authored and maze committed 2026-10-29 17:29:41 +01:00
1 parent 0295eb1ad2
commit b8a493b93d
138 files changed
+1898 -57607

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
package main
import (
"os"
"path/filepath"
"github.com/kyoh86/xdg"
"github.com/sirupsen/logrus"
)
const (
configFileBase = "harmon.conf"
configFileBaseAlt = "harmon.cfg"
)
func findConfigFile() string {
var name string
for _, dir := range append(xdg.AllConfigDirs(), ".") {
// Base
name = filepath.Join(dir, configFileBase)
logrus.WithField("name", name).Trace("auto detecting configuration file")
if i, err := os.Stat(name); err == nil && !i.IsDir() {
logrus.WithField("name", name).Trace("found configuration file")
return name
}
// Alt
name = filepath.Join(dir, configFileBaseAlt)
logrus.WithField("name", name).Trace("auto detecting configuration file")
if i, err := os.Stat(name); err == nil && !i.IsDir() {
logrus.WithField("name", name).Trace("found configuration file")
return name
}
}
return ""
}