diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-16 09:17:08 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-16 09:17:08 +0200 |
| commit | bcfeb773afcc28641ef2fb47749c91fd0767054a (patch) | |
| tree | f8593c29bad0b204f1ecc9cae650b55f3cc755d6 /gui/cmd/krino-gui/paths.go | |
| parent | 4f98392c9a062e9d4dd8363a2ede9a919ad14006 (diff) | |
| download | krino-bcfeb773afcc28641ef2fb47749c91fd0767054a.tar.gz krino-bcfeb773afcc28641ef2fb47749c91fd0767054a.zip | |
gui: the Plan tab - scan, review, apply, with the directory locked
Diffstat (limited to 'gui/cmd/krino-gui/paths.go')
| -rw-r--r-- | gui/cmd/krino-gui/paths.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gui/cmd/krino-gui/paths.go b/gui/cmd/krino-gui/paths.go new file mode 100644 index 0000000..447fc15 --- /dev/null +++ b/gui/cmd/krino-gui/paths.go @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package main + +import ( + "fmt" + "os" + "path/filepath" + + "krino/internal/config" + "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)) + } +} |
