github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/internal/xdg/base.go (about) 1 package xdg 2 3 import ( 4 "path/filepath" 5 6 "github.com/adrg/xdg" 7 ) 8 9 // Interface wrapper around 10 // https://github.com/adrg/xdg 11 12 type Base interface { 13 CacheFile(relPath string) (string, error) 14 ConfigFile(relPath string) (string, error) 15 DataFile(relPath string) (string, error) 16 StateFile(relPath string) (string, error) 17 RuntimeFile(relPath string) (string, error) 18 } 19 20 const appName = "tilt-dev" 21 22 type tiltDevBase struct { 23 } 24 25 func NewTiltDevBase() Base { 26 return tiltDevBase{} 27 } 28 29 func (tiltDevBase) CacheFile(relPath string) (string, error) { 30 return xdg.CacheFile(filepath.Join(appName, relPath)) 31 } 32 func (tiltDevBase) ConfigFile(relPath string) (string, error) { 33 return xdg.ConfigFile(filepath.Join(appName, relPath)) 34 } 35 func (tiltDevBase) DataFile(relPath string) (string, error) { 36 return xdg.DataFile(filepath.Join(appName, relPath)) 37 } 38 func (tiltDevBase) StateFile(relPath string) (string, error) { 39 return xdg.StateFile(filepath.Join(appName, relPath)) 40 } 41 func (tiltDevBase) RuntimeFile(relPath string) (string, error) { 42 return xdg.RuntimeFile(filepath.Join(appName, relPath)) 43 }