// SPDX-License-Identifier: GPL-3.0-or-later package main import ( "fmt" "os" "path/filepath" "git.labunix.xyz/krino/internal/config" "git.labunix.xyz/krino/internal/xdg" ) // cacheDir is where every directory's keyword cache lives (spec ยง6.1), the // same place krino uses. func cacheDir() string { return filepath.Join(xdg.CacheHome(), "krino") } // mainFile is -c FILE, or the default krino.conf - the same rule the // command line follows, tilde and all. func mainFile(conf string) string { if conf != "" { return xdg.Expand(conf) } return config.DefaultFile() } // printDiags reports configuration problems the way krino(1) does, so a // file that will not load reads the same however it was opened. func printDiags(errs []*config.Diag) { for _, e := range errs { d := *e d.File = xdg.Abbrev(d.File) fmt.Fprintln(os.Stderr, &d) } if len(errs) == 1 { fmt.Fprintln(os.Stderr, "krino-gui: 1 problem found") } else { fmt.Fprintf(os.Stderr, "krino-gui: %d problems found\n", len(errs)) } }