package config import ( "fmt" "os" "path/filepath" ) // Global app paths (used by all other packages) var ( ConfigDir string CacheDir string DataDir string ) // Init creates the required directories and prints their paths if missing. func Init() { home, err := os.UserHomeDir() if err != nil { fmt.Println("Error: cannot resolve home directory:", err) os.Exit(1) } ConfigDir = filepath.Join(home, ".config", "skyfeed") CacheDir = filepath.Join(home, ".cache", "skyfeed") DataDir = filepath.Join(home, ".local", "share", "skyfeed") dirs := []string{ConfigDir, CacheDir, DataDir} for _, dir := range dirs { if _, err := os.Stat(dir); os.IsNotExist(err) { err := os.MkdirAll(dir, 0755) if err != nil { fmt.Printf("Error creating %s: %v\n", dir, err) os.Exit(1) } } } }