Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: utils/utils.go: fix create boilerplate directoy to current working directory on Windows and refs other XDG_DATA_HOME and LOCALAPPDATA #62

Merged
merged 3 commits into from
Dec 14, 2023

Conversation

atsushifx
Copy link
Contributor

On Windows, create boiler plate directory to current working directory.
move this directory to LOCALAPPDATA directory
ref
add: utils/utils.go: boiler plate directory refs "XDG_DATA_HOME"
create boiler directory under the XDG_DATA_HOME directory,
if your os set set XDG Base directory.

add: .editorconfig:
editor tab setting file for go source edit.

  On Windows, create boiler plate directory to current working directory.
  move this directory to LOCALAPPDATA directory

add: utils/utils.go: boiler plate directory refs "XDG_DATA_HOME"
  create boiler directory under the XDG_DATA_HOME directory,
  if your os set set XDG Base directory.

add: .editorconfig:
  editor tab setting file for go source edit.
utils/utils.go Outdated

override = os.Getenv("XDG_DATA_HOME")
if len(override) > 0 {
return filepath.Join(override, "gibo", gitignoreDir)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the drive-by review, but I'd like to point out that directories in $XDG_DATA_HOME, $XDG_CONFIG_HOME, etc. should not be hidden. So it should be something like path.join(XDG_DATA_HOME, 'gibo', 'gitignore-boilerplates')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so match for this quick review.
I change PR to boilerplates directory is not hidden in XDG Base Directories and LOCALAPPDATA.

@simonwhitaker
Copy link
Owner

simonwhitaker commented Dec 13, 2023

Hi @atsushifx! Thank you for contributing to gibo. And special thanks for contributing to gibo on Windows.

Can you please remove the editorconfig file from this PR and raise that as a separate PR? I'd like to merge your home dir fix, but I'd also like to think about the editorconfig change a bit more before merging that one.

@atsushifx
Copy link
Contributor Author

I understood. I make new commit "remove editor config", then this PR have only utils/utils.go file.
please merge this if you have no probllem.

@simonwhitaker simonwhitaker merged commit 824fa13 into simonwhitaker:main Dec 14, 2023
1 check passed
@simonwhitaker
Copy link
Owner

Hey @atsushifx... I thought you'd like to know, I was inspired by your PR to also store the boilerplates in the right place on MacOS too (i.e. ~/Library/Caches), and that in turn lead me to discover go's os.UserCacheDir(). I've incorporated that in bd62924.

@atsushifx
Copy link
Contributor Author

I read this commit, and I want to make 2 sugesstions.

  1. commit bd6924 make boilerplates cache on gibo directory directly. add boilerplates directory to cache , if another data cache by future.

  2. I use XDG Base Directory Environment on Windows. But os.os.UserCacheDir() function don't return XDG_CACHE_HOME instead of LOCALAPPDATA, please get $XDG_CACHE_HOME directory on windows , if you can change this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants