mirror of
https://github.com/Rudi9719/kbtui.git
synced 2026-03-22 11:07:22 +00:00
"~/" does not work as hoped for
i.e. it is expanded only by a shell, not a system call, so ~/.config/kbtui.toml was never used.
This commit is contained in:
@ -50,7 +50,7 @@ func cmdConfig(cmd []string) {
|
|||||||
|
|
||||||
func readConfig(filepath ...string) (*Config, error) {
|
func readConfig(filepath ...string) (*Config, error) {
|
||||||
var result = new(Config)
|
var result = new(Config)
|
||||||
var configFile string
|
var configFile, path string
|
||||||
var env bool
|
var env bool
|
||||||
|
|
||||||
// Load default config first, this way any values missing from the provided config file will remain the default value
|
// Load default config first, this way any values missing from the provided config file will remain the default value
|
||||||
@ -61,10 +61,15 @@ func readConfig(filepath ...string) (*Config, error) {
|
|||||||
case 0:
|
case 0:
|
||||||
configFile, env = os.LookupEnv("KBTUI_CFG")
|
configFile, env = os.LookupEnv("KBTUI_CFG")
|
||||||
if !env {
|
if !env {
|
||||||
configFile = "~/.config/kbtui.toml"
|
path, env = os.LookupEnv("HOME")
|
||||||
|
if env {
|
||||||
|
configFile = path + "/.config/kbtui.toml"
|
||||||
if _, err := os.Stat(configFile); os.IsNotExist(err) {
|
if _, err := os.Stat(configFile); os.IsNotExist(err) {
|
||||||
configFile = "kbtui.toml"
|
configFile = "kbtui.toml"
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
configFile = "kbtui.toml"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
configFile = filepath[0]
|
configFile = filepath[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user