intake/core/data.go

22 lines
490 B
Go
Raw Normal View History

2025-01-28 05:54:46 +00:00
package core
import (
"os"
"path/filepath"
)
func ResolveDataDir() string {
if intakeData := os.Getenv("INTAKE_DATA_DIR"); intakeData != "" {
return intakeData
} else if xdgData := os.Getenv("XDG_DATA_HOME"); xdgData != "" {
return filepath.Join(xdgData, "intake")
} else if home := os.Getenv("HOME"); home != "" {
return filepath.Join(home, ".local", "share", "intake")
}
return ""
}
func DatabasePath(dataDir string) string {
return filepath.Join(dataDir, "intake.db")
}