zed icon indicating copy to clipboard operation
zed copied to clipboard

Zed creates ~/.cache/zed and ignores XDG_CACHE_HOME on MacOS

Open ftpd opened this issue 1 year ago • 4 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

Zed creates ~/.cache/zed after each run. It should rather use XDG_CACHE_HOME, which in my case is set to /tmp/ (which doesn't really matter).

Environment

Zed: v0.143.6 (Zed) OS: macOS 15.0.0 Memory: 18 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

ftpd avatar Jul 11 '24 23:07 ftpd

Yep. Looks like we are not checking XDG_CACHE_HOME on linux and are only checking FLATPAK_XDG_CACHE_HOME:

https://github.com/zed-industries/zed/blob/489077befcc1ac4e1aa4505fa3f27f1a6528da48/crates/paths/src/paths.rs#L58-L79

Shouldn't be too hard to fix. Happy to accept PRs.

notpeter avatar Jul 12 '24 23:07 notpeter

Yep. Looks like we are not checking XDG_CACHE_HOME on linux

It is checking XDG_CACHE_HOME on linux by calling dirs::cache_dir(). Also, can you remove the linux since this was filed under a MacOS environment and linux is functioning corrrectly?

Environment Zed: v0.143.6 (Zed) OS: macOS 15.0.0 Memory: 18 GiB Architecture: aarch64

MacOS doesn't use XDG environment variables, so it is expected that it wouldn't be followed. Either way, dirs::cache_dir() should probably also be called on MacOS instead of just putting it in .cache it would be put in the proper location $HOME/Library/Caches.

someone13574 avatar Jul 13 '24 02:07 someone13574

Sorry I had misread your specs. I've retagged it as MacOS. Nice catch.

I see your point, if we're going to act XDG-like and use ~/.cache/ by default we should consider allowing XDG_CACHE_HOME to override. But I think we are unlikely to respect XDG_CACHE_HOME on MacOS.

It might be appropriate to switch to dirs::cache_dir() as I believe already use ~/Library/Caches/dev.zed.Zed elsewhere. Alternatively we could just use $TMPDIR.

Anyways, I think I understand your request.

notpeter avatar Jul 13 '24 03:07 notpeter

MacOS doesn't use XDG environment variables, so it is expected that it wouldn't be followed.

It's not a task for operating system anyway. Programs running on it do or don't use these variables. I'm setting XDG_*_HOME on both Linux and macOS and I expect software I run to follow it ;-)

~/Library/Caches as a 'hardcoded' value fits me too. Everything but ~/.cache ;-)

ftpd avatar Jul 13 '24 09:07 ftpd

Is there any update on this? I also hope to follow this specification or set environment variables directly within the ZED software. Since ZED currently lacks multi-end synchronization for configuration and other data, we can achieve configuration synchronization by synchronizing data within this directory.

kilingzhang avatar Aug 28 '24 08:08 kilingzhang

Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, we'll close it in 7 days. Thanks for your help!

github-actions[bot] avatar Mar 11 '25 11:03 github-actions[bot]

This issue was closed due to inactivity. If you're still experiencing this problem, please open a new issue with a link to this issue.

github-actions[bot] avatar Mar 18 '25 15:03 github-actions[bot]