22 lines
490 B
Go
22 lines
490 B
Go
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")
|
|
}
|