Start work on history support for readline

This commit is contained in:
Kovid Goyal
2022-10-14 21:34:52 +05:30
parent fe91af5e09
commit 88567f69b2
4 changed files with 208 additions and 4 deletions

View File

@@ -102,6 +102,28 @@ func ConfigDir() string {
return config_dir
}
var cache_dir string
func CacheDir() string {
if cache_dir != "" {
return cache_dir
}
candidate := ""
if edir := os.Getenv("KITTY_CACHE_DIRECTORY"); edir != "" {
candidate = Abspath(Expanduser(edir))
} else if runtime.GOOS == "darwin" {
candidate = Expanduser("~/Library/Caches/kitty")
} else {
candidate = os.Getenv("XDG_CACHE_HOME")
if candidate == "" {
candidate = "~/.cache"
}
candidate = filepath.Join(Expanduser(candidate), "kitty")
}
os.MkdirAll(candidate, 0o755)
return candidate
}
type Walk_callback func(path, abspath string, d fs.DirEntry, err error) error
func transform_symlink(path string) string {