Removed 'get' prefix from DataDir() and ConfigDir()
This commit is contained in:
parent
c8a1e3e105
commit
db27a22347
@ -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{}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user