Given a symlink, I want to know to which directory this symlink is pointing. Does the Rust standard library offer something to find this out? I have only found unstable API functions so far.
Get actual path symlink is pointing to
It seems to me that you want fs::read_link
:
Reads a symbolic link, returning the file that the link points to.
You can use std::fs::canonicalize
:
Returns the canonical, absolute form of a path with all intermediate components normalized and symbolic links resolved.
© 2022 - 2024 — McMap. All rights reserved.