dirs-dev / dirs-rs

a low-level library that provides config/cache/data paths, following the respective conventions on Linux, macOS and Windows

Home Page:https://dirs.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prefer $HOME (and XDG environment) even on Windows

elmarco opened this issue · comments

Hi,

Various projects ported to Windows take $HOME value first (and XDG env), before looking up FOLDERID_Profile etc. This is the case for example with glib (on msys2 or not).

Would it make sense to add some "xdg" feature to follow this behaviour, even on Windows or other platforms?

commented

Hi Marc-Andre,

this library is intended to expose the paths as defined by the operating system in question.
For people who want go the extra mile and try to ignore those conventions, this is not the library to pick.

Thanks for the reply, that's what I expected. However, since you already have the logic for some XDG compliance, it may make sense to allow such feature on other platforms. Otherwise, which library would you recommend? thanks agian

commented

Hi,

it's an explicit decision to only support the directory convention that the operating system specified on each OS respectively.

People that have tried to be "smart" or "creative" have caused a lot of mess, which this library is intended to reduce/fix.

If you want to add your special sauce for one or more platforms, just write the code for it.

For anyone interested, I've created xdg-home crate.

Hi,

it's an explicit decision to only support the directory convention that the operating system specified on each OS respectively.

People that have tried to be "smart" or "creative" have caused a lot of mess, which this library is intended to reduce/fix.

If you want to add your special sauce for one or more platforms, just write the code for it.

I'm curious what is "smart" or "creative" about respecting the XDG preferences users have explicitly set. At least provide some config option to enable respecting XDG dirs on all platforms?

@uncenter just fyi I made a crate that does respect xdg: https://crates.io/crates/xdg-home

Also, https://crates.io/crates/etcetera/. I didn't create it, but I maintain it.

@uncenter just fyi I made a crate that does respect xdg: crates.io/crates/xdg-home

This only does the home directory though, and none of the other paths dirs offers.

@uncenter just fyi I made a crate that does respect xdg: crates.io/crates/xdg-home

This only does the home directory though, and none of the other paths dirs offers.

Yeah, I only implemented the part I needed. Contributions to add more API more than welcome. 👍

@uncenter I'll answer - nothing. The current standards for paths are beyond useless:

  • there's 0 thought about cross-system setups, e.g. config dir that can be used for cloud sync on both Windows and Linux without any extra trash that would be in Windows Roaming (~15 GB on my system, while configs alone would be max 10-20 MB), for example - do devs behind these "smart" and "creative" decisions never use cloud?
  • there's 0 system-wide verification if devs are using these standards properly, e.g. you can easily have whole popular Windows installer (Squirrel) that installs to LOCALAPPDATA used by popular software, while obviously the intended place is any of the PROGRAMFILES. So going sheriff mode in such libraries is entirely pointless anyways when way bigger (actually often related to security) mistakes occur on regular basis. It's like preventing drivers on deserted highways to exceed speed limit by 1 km/h while in meanwhile bunch of other drivers decide to accelerate to 200 km/h on small roads near schools.

I honestly feel like we're still in early 2000s in terms of some standards. In the end they're just nuisance for users as developers choose to go for easiest way possible of using libraries like this one instead of implementing own modern flows for e.g. config locations that are actually suitable for user needs that are not rare nowadays.