dirs-dev / directories-rs

a mid-level library that provides config/cache/data paths, following the respective conventions on Linux, macOS and Windows
https://dirs.dev
Apache License 2.0
775 stars 36 forks source link

Add a way to force usage of ogranisation name on Linux #66

Open suve opened 3 years ago

suve commented 3 years ago

Currently, on Linux, the organisation name is ignored, and e.g. ProjectDirs::config_dir() will return simply ~/.config/appname. This may be enough for applications with some very unique names, but when using some more generic words, can lead to conflicts.

I'd like a way to force the lib to use the organisation name on Linux, so I'd get e.g ~/.config/suve/appname instead of just ~/.config/appname.

soc commented 3 years ago

Hi @suve, are there examples of existing applications doing this?

suve commented 3 years ago

While I admit I failed to find FLOSS, there's quite a few proprietary programs doing this, e.g.:

suve commented 3 years ago

Oh, right. How could I forget. The SDL_GetPrefPath() function in the SDL 2.x library does this, so most games based on SDL2 inherit this behaviour. (Source code)

soc commented 3 years ago

@suve To be honest, these examples all look like terrible porting jobs (i. e. simply copying Microsoft conventions to a platform that isn't Windows) – exactly the outcomes this library is intended to prevent.

aakside commented 2 months ago

Do you discourage generically-named applications (example bundle ID: com.example.contacts) or is there a recommended approach to avoid collisions on Linux with other similarly-named applications (e.g., always attempt to create a unique sub-directory to namespace the app's config/data)?

soc commented 2 months ago

If there were wider ecosystem consensus, this is something to consider integrating in some way, but this library is intended to support existing conventions, not invent its own.