Fix custom config file path. #106

pull/112/head^2
Miguel Mota 3 years ago
parent c79d601bbf
commit e0acaf9554
No known key found for this signature in database
GPG Key ID: 67EC1161588A00F9

@ -98,11 +98,16 @@ func (ct *Cointop) SetupConfig() error {
func (ct *Cointop) CreateConfigIfNotExists() error {
ct.debuglog("createConfigIfNotExists()")
for _, configPath := range possibleConfigPaths {
normalizedPath := pathutil.NormalizePath(configPath)
if _, err := os.Stat(normalizedPath); err == nil {
ct.configFilepath = normalizedPath
return nil
ct.configFilepath = pathutil.NormalizePath(ct.configFilepath)
// check if config file exists in one of th default paths
if ct.configFilepath == DefaultConfigFilepath {
for _, configPath := range possibleConfigPaths {
normalizedPath := pathutil.NormalizePath(configPath)
if _, err := os.Stat(normalizedPath); err == nil {
ct.configFilepath = normalizedPath
return nil
}
}
}

Loading…
Cancel
Save