refactor: rename NewConfig to LoadConfig
This commit is contained in:
parent
7fab952886
commit
4ac65d3cd7
2 changed files with 4 additions and 3 deletions
2
main.go
2
main.go
|
|
@ -23,7 +23,7 @@ var (
|
|||
)
|
||||
|
||||
func main() {
|
||||
conf = util.NewConfig()
|
||||
conf = util.LoadConfig()
|
||||
|
||||
tview.Borders.Horizontal = conf.Borders.Horizontal
|
||||
tview.Borders.Vertical = conf.Borders.Vertical
|
||||
|
|
|
|||
|
|
@ -64,14 +64,15 @@ type Config struct {
|
|||
Borders borders `toml:"borders"`
|
||||
}
|
||||
|
||||
// NewConfig loads the configuration file, if the configuration file exists or creates a new one if not, and returns it.
|
||||
func NewConfig() *Config {
|
||||
// LoadConfig loads the configuration file, if the configuration file exists or creates a new one if not, and returns it.
|
||||
func LoadConfig() *Config {
|
||||
configPath, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
configPath += "/discordo.toml"
|
||||
|
||||
var c Config
|
||||
if _, err = os.Stat(configPath); os.IsNotExist(err) {
|
||||
f, err := os.Create(configPath)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue