1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
package main import ( "os" "path/filepath" "github.com/goulash/xdg" ) func MaybeWriteConfig() { path := xdg.FindConfig("timetasker/config.toml") if path == "" { path = filepath.Join(xdg.ConfigHome, "timetasker") if _, err := os.Stat(path); os.IsNotExist(err) { os.Mkdir(path, 0700) } } }