Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit e0acaf9

Browse files
committed
Fix custom config file path. #106
1 parent c79d601 commit e0acaf9

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

cointop/config.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,16 @@ func (ct *Cointop) SetupConfig() error {
9898
func (ct *Cointop) CreateConfigIfNotExists() error {
9999
ct.debuglog("createConfigIfNotExists()")
100100

101-
for _, configPath := range possibleConfigPaths {
102-
normalizedPath := pathutil.NormalizePath(configPath)
103-
if _, err := os.Stat(normalizedPath); err == nil {
104-
ct.configFilepath = normalizedPath
105-
return nil
101+
ct.configFilepath = pathutil.NormalizePath(ct.configFilepath)
102+
103+
// check if config file exists in one of th default paths
104+
if ct.configFilepath == DefaultConfigFilepath {
105+
for _, configPath := range possibleConfigPaths {
106+
normalizedPath := pathutil.NormalizePath(configPath)
107+
if _, err := os.Stat(normalizedPath); err == nil {
108+
ct.configFilepath = normalizedPath
109+
return nil
110+
}
106111
}
107112
}
108113

0 commit comments

Comments
 (0)