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

Use Xdg base directory specifications for your files #5

Closed
guildem opened this issue Apr 7, 2024 · 7 comments
Closed

Use Xdg base directory specifications for your files #5

guildem opened this issue Apr 7, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@guildem
Copy link

guildem commented Apr 7, 2024

There is a list of the possible folders :

  • configFolder : $XDG_CONFIG_HOME/superfile
  • themeFolder : $XDG_CONFIG_HOME/superfile/theme
  • trashFolder : see Use Xdg Trash specification to stay compatible with other file managers #4
  • dataFolder : $XDG_STATE_HOME/superfile
  • lastCheckVersion : "$dataFolder/lastCheckVersion"
  • pinnedFile : "dataFolder/pinned.json"
  • configFile : "$configFolder/config.json"
  • themeZipName : "$themeFolder/theme.zip"
  • logFile : "$dataFolder/superfile.log"

This is the specification : https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Some more informations : https://wiki.archlinux.org/title/XDG_Base_Directory

@yorukot
Copy link
Owner

yorukot commented Apr 7, 2024

$XDG_CONFIG_HOME seems just $HOME/.config
Ok i think i can will change it

and the trashFolder i need some time to Research what is that :(

@yorukot
Copy link
Owner

yorukot commented Apr 7, 2024

Update will release in v1.0.1 886dbfb

@yorukot yorukot added the enhancement New feature or request label Apr 7, 2024
@guildem
Copy link
Author

guildem commented Apr 7, 2024

To be sure that write I wrote in the commit appears for every issue reader, I copy it here :

--

HomeDir + "/.config/superfile" should be a backup folder only if $XDG_CONFIG_HOME doesn't exists.

To not access the env var directly you can use https://pkg.go.dev/github.com/rkoesters/xdg/basedir.

Don't forget to change the dataFolder to $XDG_DATA_HOME or the rkoesters/xdg/basedir equivalent (and backup folder).

@yorukot
Copy link
Owner

yorukot commented Apr 8, 2024

ok i just fix in here

but i think i wont change the data folder because i think it's a bit unnecessary

@guildem
Copy link
Author

guildem commented Apr 8, 2024

The use case for a separate data folder is config synchronisation. I have a main host used to work daily, a laptop when I'm not at home, and a macmini for specific usage. I sync my config files between all of them.

Why would I need to sync logs and version check ? These are related to each host. The config folder is made for app configuration, and data/state folders are made to store the state of the app on the host. The last folder is cache, where we can delete files without changing application state or configuration because it will be rebuilt on the next start. It even can be cleaned on each reboot.

So config is dotfiles saved and shareable, state is fixed to one host, cache is volatile and deletable. That's the necessity of the data/state folders (set in $XDG_DATA_DIR or $XDG_STATE_DIR).

This is only an advice, easier to fix on early versions, but now it's you're decision.

@yorukot
Copy link
Owner

yorukot commented Apr 9, 2024

I didn't notice the problem of config synchronization

Got it,next version will be changed

@yorukot
Copy link
Owner

yorukot commented Apr 9, 2024

I think this can be close

  • Update log file from $XDG_CONFIG_HOME/superfile/data/superfile.log to $XDG_CACH_DATA #27
  • Update data folder from $XDG_CONFIG_HOME/superfile/data to $XDG_DATA_HOME/superfile 9fff97a
  • Update $HOME/.superfile to $XDG_CONFIG_HOME/superfile 886dbfb

@yorukot yorukot closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants