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
748 stars 33 forks source link

System folders? #58

Open cheako opened 5 years ago

cheako commented 5 years ago

Need to know if to use Program\ Files or /usr/share or /usr/games/share.

Ralith commented 4 years ago

It would be very helpful to have something exposing the contents of XDG_DATA_DIRS with the project suffix applied (or indeed at all).

rope-hmg commented 3 years ago

If this includes /Applications or /Users/name/Applications on the Mac that would be super useful.

alkarkhi commented 2 years ago

@soc Is this feature something you'd want in this crate? I might be able to dedicate some free time on this

andrewbaxter commented 1 month ago

These are all related: #87 #82 #78

andrewbaxter commented 1 month ago

The readme says this

This library is intentionally focused on providing information on user-writable directories only, as there is no discernible benefit in returning a path that points to a user-level, writable directory on one operating system, but a system-level, read-only directory on another.

i.e. it seems to explicitly exclude system directories, which is unfortunate because the name "directories" suggests it'd be all-encompasing, at least to this degree.

I'd really like a one-stop shop library I can use where I just call get_data_dir() or whatever and get the correct directory, regardless of operating environment (system service, systemd, user).

cheako commented 1 month ago

That's some misapplied philosophy. In science, it's clear that data should lead to conclusions instead of a conclusion filtering for data, however with software it's the users/clients who write the use cases... libraries shouldn't be written with a use case in mind, that's likewise backwards.

What this library does is return one set of directories for one OS and another set of directories for others, limiting the list of directories returned based on how the data is to be used is plainly wrong.

Edit: It's like the library trying to select what project's it's included in.

andrewbaxter commented 1 month ago

Sorry, I might have misinterpreted that quote... it may be the important distinction is between writable and read-only directories and the "user" vs "system-level" thing is meant to be an example rather than criteria.

Regardless, it would be good if a maintainer could confirm a contribution in this regard would be considered, and maybe describe how the current architecture could be changed to accommodate.

cheako commented 1 month ago

Some system directories are writable /tmp, /dev/shm, /var/tmp... I don't know what these would be anywhere other than on Linux, but if Windows wants my apps they have to write the compatibility layer.