-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpaths.go
More file actions
38 lines (31 loc) · 740 Bytes
/
paths.go
File metadata and controls
38 lines (31 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"os"
"path/filepath"
)
func cacheDir() string {
if v := os.Getenv("XDG_CACHE_HOME"); v != "" {
return filepath.Join(v, "glance", "captures")
}
d, _ := os.UserCacheDir()
return filepath.Join(d, "glance", "captures")
}
func configDir() string {
if v := os.Getenv("XDG_CONFIG_HOME"); v != "" {
return filepath.Join(v, "glance")
}
d, _ := os.UserConfigDir()
return filepath.Join(d, "glance")
}
func configPath() string {
return filepath.Join(configDir(), "presets.csv")
}
func capturePath(id string) string {
return filepath.Join(cacheDir(), id+".txt")
}
func ensureCacheDir() error {
return os.MkdirAll(cacheDir(), 0o755)
}
func ensureConfigDir() error {
return os.MkdirAll(configDir(), 0o755)
}