[Python-Dev] Add os.path.resolve to simplify the use of os.readlink (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Thu Jun 21 13🔞43 CEST 2012
- Previous message: [Python-Dev] Add os.path.resolve to simplify the use of os.readlink
- Next message: [Python-Dev] Add os.path.resolve to simplify the use of os.readlink
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 21 Jun 2012 11:10:44 -0000 "Armin Ronacher" <armin.ronacher at active-4.com> wrote:
Hi,
> Am 21.06.2012 12:23, schrieb Armin Ronacher: > Does the code handle a chain of absolute and relative symlinks > correctly, for example a relative symlink that points to another > relative symlink in a different directory that points to a file in a > third directry? No, but that's a good point. It should attempt to resolve these in a loop until it either loops too often (would have to check the POSIX spec for a reasonable value) or until it terminates by finding an actual file or directory.
You could take a look at the resolve() algorithm in pathlib: http://pypi.python.org/pypi/pathlib/
Regards
Antoine.
- Previous message: [Python-Dev] Add os.path.resolve to simplify the use of os.readlink
- Next message: [Python-Dev] Add os.path.resolve to simplify the use of os.readlink
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]