Skip to content

Commit

Permalink
chore: fix utils/utils.go / repoDir (#63)
Browse files Browse the repository at this point in the history
* chore: fix utils/utils.go / repoDir
  - first, reference $XDG_CACHE_HOME directory to All OS's cache
	directory
  - fix: change save directory gibo to gibo/gitignore-boilerplates
  - fix: compare string change == to string.equalFold

* fix: remove XDG_Base from 1st use

---------

Co-authored-by: Simon Whitaker <[email protected]>
  • Loading branch information
atsushifx and simonwhitaker authored Dec 22, 2023
1 parent cc17846 commit 80d3191
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func RepoDir() string {
if err != nil {
log.Fatalln("gibo can't determine your user cache directory. Please file an issue at https://github.com/simonwhitaker/gibo/issues")
}
return filepath.Join(cacheDir, "gibo")
return filepath.Join(cacheDir, "gibo", "gitignore-boilerplates")
}

func cloneRepo(repo string) error {
Expand Down Expand Up @@ -56,7 +56,7 @@ func pathForBoilerplate(name string) (string, error) {
filename := name + ".gitignore"
var result string = ""
filepath.WalkDir(RepoDir(), func(path string, d fs.DirEntry, err error) error {
if strings.ToLower(filepath.Base(path)) == strings.ToLower(filename) {
if strings.EqualFold(filepath.Base(path), filename) {
result = path
// Exit WalkDir early, we've found our match
return filepath.SkipAll
Expand Down

0 comments on commit 80d3191

Please sign in to comment.