diff options
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r-- | Lib/pathlib.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 911b774b56..1ba98b19e8 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -411,6 +411,8 @@ class _NormalAccessor(_Accessor): unlink = os.unlink + link_to = os.link + rmdir = os.rmdir rename = os.rename @@ -1303,6 +1305,14 @@ class Path(PurePath): self._raise_closed() return self._accessor.lstat(self) + def link_to(self, target): + """ + Create a hard link pointing to a path named target. + """ + if self._closed: + self._raise_closed() + self._accessor.link_to(self, target) + def rename(self, target): """ Rename this path to the given path. |