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

pathlib support #120

Open
LucidOne opened this issue Feb 22, 2019 · 4 comments
Open

pathlib support #120

LucidOne opened this issue Feb 22, 2019 · 4 comments

Comments

@LucidOne
Copy link

Any thoughts on pathlib support?

@pmiddend
Copy link

pmiddend commented Oct 3, 2019

I'd appreciate that, too.

@McSinyx
Copy link

McSinyx commented Oct 3, 2019

@pmiddend #123 is working on it, but there's a design issue.

@keturn
Copy link

keturn commented Dec 14, 2019

Hmm. Path does not implement str, so having functions that return different types in different environments (as #123 does) would be real rough on compatibility and type checking (e.g. #75).

My inclination would be to add a new parallel interface. So for anyone doing from appdirs import import AppDirs it'll keep working like it always has, and people who want Paths can do from appdirs.paths import AppPaths or somesuch.

The stinker is, when writing code to provide both Path and string version of things, it's usually easier and safer to start with the Path version and then convert to string when necessary, instead of doing most of the path building old string-manipulation style. But this library is quite careful about always using the os.path functions and the inputs are going to be hard-coded values from the application instead of scary user input, so it's probably fine to build strings and convert.

[…keturn does some experiments…]

Wait, what?

pathlib.Path does not throw InsecurePath if you do something like user_state_dir().joinpath('saves', '/etc/passwd')?

HECK okay fine forget anything I said about "safety." Carry on!

@McSinyx
Copy link

McSinyx commented Jul 31, 2021

I made a fork embracing pathlib called loca. Cc @clbarnes and @untzag.

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