fs.readlink
Read the target stored in a symbolic link.
Usage
fs.readlink(path)
path- The symlink to inspect.
Returns the target string as stored in the link. A relative target remains relative to the link's parent directory; it is not resolved against the script's working directory. The target need not exist. A missing path, ordinary file, or inaccessible symlink raises an error.
info = fs.stat("current", follow_symlinks = False)
if info.is_symlink:
print(fs.readlink("current"))
Relative paths resolve against the script's working directory, including when called from a loaded module. Absolute paths are used as given. These functions inspect the local filesystem; they do not isolate access to the repository. Calls honor cancellation before and after the filesystem operation.
See reading files and Git hooks.