tox-dev / platformdirs

A small Python module for determining appropriate platform-specific dirs, e.g. a "user data dir".
https://platformdirs.readthedocs.io
MIT License
593 stars 51 forks source link

multipath cannot work for path #259

Open Freed-Wu opened 9 months ago

Freed-Wu commented 9 months ago
❯ export XDG_DATA_DIRS=/usr/share:/usr/local/share
❯ ptpython
In [1]: from platformdirs import site_data_path
In [2]: site_data_path(multipath=True)
PosixPath('/usr/share')

Why not

In [2]: site_data_path(multipath=True)
[PosixPath('/usr/share'), PosixPath('/usr/local/share')]

Related issue: https://github.com/NixOS/nixpkgs/issues/282076

Sachaa-Thanasius commented 9 months ago

site_data_path is explicitly documented as returning only one path, even with multipath passed in as True. Have you considered using site_data_dir(multipath=True) for your use case?

Freed-Wu commented 9 months ago

Now I use [Path(dir) for dir in site_data_dir(multipath=True).split(":")]

site_data_path is explicitly documented as returning only one path

Why it cannot return multi paths?

Sachaa-Thanasius commented 9 months ago

As a bystander, I can't speak for the developers of this library, but if I had to guess? It might be an established convention in the library for *_path methods to return a single path, even on Unix systems, even with multipath given. If that's strange, consider a more explicit feature/bugfix request and maybe a PR.

Freed-Wu commented 9 months ago

If that's strange

So is it a bug need to be fixed or a correct feature which will not be changed?

Sachaa-Thanasius commented 9 months ago

I would personally consider this a known API feature, but I’m not you.