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

~/Library/Preferences should not be used on macOS #6

Open
kidonng opened this issue Apr 15, 2021 · 6 comments
Open

~/Library/Preferences should not be used on macOS #6

kidonng opened this issue Apr 15, 2021 · 6 comments

Comments

@kidonng
Copy link

kidonng commented Apr 15, 2021

This has been discussed in other places, like dirs-dev/directories-rs#62.
The basic idea is that this folder should only be interacted via macOS's native API, otherwise apps should use ~/Library/Application Support.

@muesli
Copy link
Owner

muesli commented Apr 22, 2021

Obviously not easy to solve without breaking API compatibility. Are there any actual real-life issues with applications using this path for non-plist files?

@kidonng
Copy link
Author

kidonng commented Apr 28, 2021

Obviously not easy to solve without breaking API compatibility.

I agree this is tough. Migrating settings is always challenging, but the benefits of a better default certainly precedes that.

Are there any actual real-life issues with applications using this path for non-plist files?

As far as I know, not really. Even some prominent macOS developers (e.g. Parallels) and frameworks (e.g. QT, though I'm not sure) does this.

But as mentioned in the referenced issue, that's still against Apple's documentation. This issue is to raise concern so we can avoid potential issues in the future.

@deanishe
Copy link

Are there any actual real-life issues with applications using this path for non-plist files?

Users and software trying to uninstall the offending application may fail to find the files because they're in a place they shouldn't be.

Also, macOS sandboxing gets more restrictive with each release, and I don't think it would surprise anybody if Apple did lock down the folder at some point. They do not care in the slightest about breaking applications that aren't following the rules.

Shame the docs weren't consulted before implementing this.

@batmac
Copy link

batmac commented Aug 12, 2022

Hi,
I understand that this is very hard to change because of existing apps, but what approach do you think I could take for a new app, because I would like to use the lib but writing to "~/Library/Preferences" is roughly a no-go ? Is there for instance a way to get XDG dirs on MacOS?

@kidonng
Copy link
Author

kidonng commented Aug 13, 2022

"no-go" is a little bit too much, I actually don't see any problem using Preferences in the foreseeable future, if we are being practical. It's just inappropriate, but so widely misused it sort of become a semi-standard.

There's basically no XDG stuff on macOS. Everything similar to that is just convention. That said, many programs do still respect $XDG_* environment variables. So if you feel like Application Support is not your thing, ~/.config is super fine (and in fact the most used location by CLI programs).

@batmac
Copy link

batmac commented Aug 14, 2022

thank you for your help !

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

4 participants