Skip to content

Commit

Permalink
Merge branch 'allow-relative-xdg-paths' of github.com:Doy-lee/trueblo…
Browse files Browse the repository at this point in the history
…cks-core into Doy-lee-allow-relative-xdg-paths
  • Loading branch information
tjayrush committed Oct 28, 2024
2 parents 5c3e9fc + 9837469 commit e6ef967
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/apps/chifra/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,16 @@ func pathFromXDG(envVar string) (string, error) {
return "", nil // it's okay if it's empty
}

if xdg[0] != string(os.PathSeparator)[0] {
return "", usage.Usage("The {0} value ({1}), must be fully qualified.", envVar, xdg)
}
absXDGPath, err := filepath.Abs(xdg);
if err != nil {
return "", usage.Usage("The {0} value ({1}), could not be interpreted as an absolute path.", envVar, xdg)
}

if _, err := os.Stat(xdg); err != nil {
return "", usage.Usage("The {0} folder ({1}) must exist.", envVar, xdg)
if _, err := os.Stat(absXDGPath); err != nil {
return "", usage.Usage("The {0} folder ({1}) must exist.", envVar, absXDGPath)
}

return filepath.Join(xdg, ""), nil
return filepath.Join(absXDGPath, ""), nil
}

func validateRpcEndpoint(chain, provider string) error {
Expand Down

0 comments on commit e6ef967

Please sign in to comment.