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

XDG Compliance #87

Closed
hyperupcall opened this issue Apr 27, 2021 · 6 comments
Closed

XDG Compliance #87

hyperupcall opened this issue Apr 27, 2021 · 6 comments

Comments

@hyperupcall
Copy link

hyperupcall commented Apr 27, 2021

Expected Behavior

Puts kb data in "${XDG_DATA_HOME:-$HOME/.local/share}/kb"

It would be great to follow the XDG Base Directory Specification and place application
data files in $XDG_DATA_HOME/kb, if it exists, and fall back to $HOME/.local/share/kb if that environment variable does not exist. It was mentioned offhand in this thread, but I would like to make an issue to address this :)

Actual Behavior

kb data put in ~/.kb.

Steps to Reproduce the Problem

Execute a kb command

Specifications

  • Version: 0.1.5
  • Platform: Linux
  • Subsystem: Arch
@xscode-auto-reply
Copy link

Thanks for opening a new issue. The team has been notified and will review it as soon as possible.
For urgent issues and priority support, visit https://xscode.com/gnebbia/kb

@gnebbia
Copy link
Owner

gnebbia commented Apr 27, 2021

Dear Sir, XDG compliance is surely a priority, hence with the next release the default directory will change its position.
Let's keep this open until it is fixed.

@gnebbia
Copy link
Owner

gnebbia commented Jun 21, 2021

Dear Sir, XDG compliance has been implemented. Of course it will break some sort of compatibility with previous versions.

A fix can be users moving $HOME/.kb into $HOME/.local/share/kb or into the XDG_DATA_HOME directory.

At the moment this is of course only implemented within the git version but as soon as 0.1.7 will come out this will be the default.

@gnebbia gnebbia closed this as completed Jun 21, 2021
@hyperupcall
Copy link
Author

Thank you very much! I am excited to see this change in the new release :)

@hyperupcall
Copy link
Author

hyperupcall commented Jun 24, 2021

@gnebbia I checked some of the changes, and I just wanted to be sure of something :P

Could it be that the following code matches your description a bit more:

BASE_PATH = Path(os.environ.get("XDG_DATA_HOME",Path(Path.home(),".local","share")),"kb")

It looks like that with the current changes, if XDG_DATA_HOME is defined, then PATH_KB would be set to $XDG_DATA_HOME and PATH_KB_GIT would be set to $XDG_DATA_HOME/.git, rather than $XDG_DATA_HOME/kb and $XDG_DATA_HOME/kb/.git, respectively

gnebbia added a commit that referenced this issue Jun 24, 2021
This solves issue #87 that is related to XDG compliance.  The error was
related to cases where the XDG_DATA_HOME environment variable was defined.
In fact, if XDG_DATA_HOME was defined, then PATH_KB would be set to
$XDG_DATA_HOME and PATH_KB_GIT would be set to $XDG_DATA_HOME/.git,
rather than $XDG_DATA_HOME/kb and $XDG_DATA_HOME/kb/.git, respectively.
@gnebbia
Copy link
Owner

gnebbia commented Jun 24, 2021

Yes you are right, my bad.

This the latest commit should fix this for good. Thanks to your suggestion and testing. Really, thanks a lot!

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

No branches or pull requests

2 participants