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

Store avatars in the user's cache directory. #1621

Merged
merged 2 commits into from
Sep 28, 2024

Conversation

eerielili
Copy link
Contributor

@eerielili eerielili commented Sep 22, 2024

Closes #1615.
Moreover, this commit separating volatile and less critical media files (avatars in ~/.cache) and important ones (in ~/.local/share/files) will make Dino fit more nicely with the FreeDesktop specifications :

  • There is a single base directory relative to which user-specific non-essential (cached) data should be written. This directory is defined by the environment variable $XDG_CACHE_HOME.

@fiaxh
Copy link
Member

fiaxh commented Sep 24, 2024

Could you please add some code that looks whether the old avatar folder exists (and the new folder doesn't exist), and if so, moves the old folder to the new location? And if both exist, just remove the old one. This could go into the constructor of the AvatarManager, before creating the new folder.

@eerielili eerielili force-pushed the dot-cache-avatars branch 2 times, most recently from fd474ae to 6496730 Compare September 25, 2024 22:03
@eerielili
Copy link
Contributor Author

eerielili commented Sep 25, 2024

@fiaxh Done. I tried to be compatible with https://specifications.freedesktop.org/trash-spec/latest/ and if not supported, fall back with GLib.

	- Not anymore in ~/.local/share, where media files are stored.
	- Already existing ~/.local/share/dino/avatars directory will be
	  moved to ~/.cache/dino/avatars
	- If both directories already exists, the old one (in
	  ~/.local/share) is removed.
@eerielili
Copy link
Contributor Author

eerielili commented Sep 25, 2024

Force-pushed just now: I made the IOError message on recursive deletion less obtuse if it occurs.

@fiaxh fiaxh merged commit 439c375 into dino:master Sep 28, 2024
3 checks passed
@fiaxh
Copy link
Member

fiaxh commented Sep 28, 2024

I think we can just remove the old folder, and don't have to move it to trash, as the data is recoverable. Also, the avatars folder shouldn't contain other folders.

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.

Add option or change Avatar storage to .cache permanently
2 participants