Skip to content

Commit ad7bd48

Browse files
committed
Updated clhome check
1 parent 4553553 commit ad7bd48

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cmd/clace/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,11 @@ func getConfigPath(cCtx *cli.Context) (string, string, error) {
108108
// Found bin directory, use its parent
109109
binParent = filepath.Dir(binParent)
110110
}
111+
fmt.Printf("bin %s binAbsolute: %s parent %s\n", binFile, binAbsolute, binParent)
111112
binParentConfig := path.Join(binParent, "clace.toml")
112-
if fileExists(binParentConfig) && strings.Contains(binParent, "clace") {
113+
if fileExists(binParentConfig) && (strings.Contains(binParent, "clace") || strings.Contains(binParent, "clhome")) {
113114
// Config file found in parent directory of the executable, use that as path
114-
// To avoid clobbering /usr, check if the path contains the string "clace"
115+
// To avoid clobbering /usr, check if the path contains the string clace/clhome
115116
return binParent, binParentConfig, nil
116117
}
117118

@@ -197,7 +198,7 @@ func main() {
197198
return nil
198199
}
199200
if err != nil {
200-
return fmt.Errorf("error parsing config %w", err)
201+
return fmt.Errorf("error parsing config: %w", err)
201202
}
202203
return nil
203204
},

0 commit comments

Comments
 (0)