Removed 'get' prefix from DataDir() and ConfigDir()

This commit is contained in:
Matt Low 2023-11-22 03:17:13 +00:00
parent c8a1e3e105
commit db27a22347
2 changed files with 4 additions and 4 deletions

View File

@ -20,7 +20,7 @@ type Config struct {
} `yaml:"chroma"` } `yaml:"chroma"`
} }
func getConfigDir() string { func ConfigDir() string {
var configDir string var configDir string
xdgConfigHome := os.Getenv("XDG_CONFIG_HOME") xdgConfigHome := os.Getenv("XDG_CONFIG_HOME")
@ -36,7 +36,7 @@ func getConfigDir() string {
} }
func NewConfig() (*Config, error) { func NewConfig() (*Config, error) {
configFile := filepath.Join(getConfigDir(), "config.yaml") configFile := filepath.Join(ConfigDir(), "config.yaml")
shouldWriteDefaults := false shouldWriteDefaults := false
c := &Config{} c := &Config{}

View File

@ -33,7 +33,7 @@ type Conversation struct {
Title string Title string
} }
func getDataDir() string { func DataDir() string {
var dataDir string var dataDir string
xdgDataHome := os.Getenv("XDG_DATA_HOME") xdgDataHome := os.Getenv("XDG_DATA_HOME")
@ -49,7 +49,7 @@ func getDataDir() string {
} }
func NewStore() (*Store, error) { func NewStore() (*Store, error) {
databaseFile := filepath.Join(getDataDir(), "conversations.db") databaseFile := filepath.Join(DataDir(), "conversations.db")
db, err := gorm.Open(sqlite.Open(databaseFile), &gorm.Config{}) db, err := gorm.Open(sqlite.Open(databaseFile), &gorm.Config{})
if err != nil { if err != nil {
return nil, fmt.Errorf("Error establishing connection to store: %v", err) return nil, fmt.Errorf("Error establishing connection to store: %v", err)