Skip to content

Commit

Permalink
Actually add the new file for issue #577
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldoussoren committed Nov 27, 2023
1 parent 59d2d5b commit 74ede11
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pyobjc-framework-Cocoa/Lib/Foundation/_nsurl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
Helpers for NSURL
"""

import objc


def __fspath__(self):
if self.scheme() == "file":
return self.fileSystemRepresentation().decode()

raise TypeError(f"NSURL with scheme {self.scheme()!r} instead of 'file'")


objc.addConvenienceForClass(
"NSURL",
(("__fspath__", __fspath__),),
)

0 comments on commit 74ede11

Please sign in to comment.