ronaldoussoren / pyobjc

The Python <-> Objective-C Bridge with bindings for macOS frameworks
https://pyobjc.readthedocs.io
563 stars 47 forks source link

proxy os.PathLike to a file-like NSURL #589

Closed ronaldoussoren closed 9 months ago

ronaldoussoren commented 10 months ago

os.PathLike is similar to Cocoa's use of NSURL to represent paths. Proxy os.PathLike to NSURL to allow using pathlib.Path values where framework's expect a file URL.

NSSecureCoding could be an issue here, NSURL implements this protocol whereas PyObjC cannot claim to support that protocol for arbitrary Python objects. It should be possible to do this for pathlib's classes though (I'm thinking of encoding those basically as the base NSURL, leaving the pickle-based implementation of NSCoding for other PathLike classes).

RhetTbull commented 5 months ago

This is wonderful! Looking forward to trying this in 10.2. Thanks for all your work on pybojc -- I use it every day in a number of projects.