You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to have an interface to read symlink’s target. There’s IO::Path::absolute but:
It expands the path to the absolute one which is not necessarily what I want to do in every situation. Sometimes I just want to know what exactly a symlink’s target is. To be able to distinguish a relative from an absolute one.
It follows all the symlinks down to the final real target. If I have a symlink like symlink-1 -> symlink-2 -> target, the target for symlink-1 is symlink-2 but .absolute returns an absolute path to target, not symlink-2.
I think you can just reuse nqp::readlink for the implementation? For now I can either make a readlink subprocess call or use this helper on top of nqp::readlink:
⚠️ To keep in mind when implementing: Symlink’s target (in case it’s a relative, non-absolute path) is relative to where the symlink file is placed. So when implementing it maybe makes sense to override the CWD to the directory of the original symlink path like I did in the helper above.
The text was updated successfully, but these errors were encountered:
I would like to have an interface to read symlink’s target. There’s
IO::Path::absolute
but:symlink-1 -> symlink-2 -> target
, the target forsymlink-1
issymlink-2
but.absolute
returns an absolute path totarget
, notsymlink-2
.I think you can just reuse
nqp::readlink
for the implementation? For now I can either make areadlink
subprocess call or use this helper on top ofnqp::readlink
:CWD
to the directory of the original symlink path like I did in the helper above.The text was updated successfully, but these errors were encountered: