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

NSURL should implement the os.PathLike protocol #577

Closed
mrpippy opened this issue Nov 1, 2023 · 2 comments
Closed

NSURL should implement the os.PathLike protocol #577

mrpippy opened this issue Nov 1, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@mrpippy
Copy link

mrpippy commented Nov 1, 2023

Is your feature request related to a problem? Please describe.
Passing NSURL objects (representing a file path) from ObjC to Python code can be tedious, I have a wrapper which calls [NSURL fileSystemRepresentation] and then copies that into an NSString to pass to Python code.

Describe the solution you'd like
If NSURL implemented the os.PathLike protocol to make it a path-like object, Python file APIs would be able to use NSURL objects directly.

@mrpippy mrpippy added the enhancement New feature or request label Nov 1, 2023
@ronaldoussoren
Copy link
Owner

Thanks. I like this idea.

ronaldoussoren added a commit that referenced this issue Nov 27, 2023
With this change it is possbile to use NSURL instances
that refer to a local filesystem path with Python APIs
that expect a pathlike object.
@ronaldoussoren
Copy link
Owner

This feature will be included in the next release of PyObjC (10.1), which will be released around the time macOS 14.2 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants