fix: bugfix to resolve absolute paths that are not symlinks

This commit is contained in:
Daniel Lang 2024-03-12 22:43:43 +01:00 committed by MartinFillon
parent 1185e0db11
commit 7eb72bd15c

View file

@ -344,7 +344,7 @@ impl<'dir> File<'dir> {
pub fn absolute_path(&self) -> Option<&PathBuf> {
self.absolute_path
.get_or_init(|| {
if self.link_target().is_broken() {
if self.is_link() && self.link_target().is_broken() {
// workaround for broken symlinks to get absolute path for parent and then
// append name of file; std::fs::canonicalize requires all path components
// (including the last one) to exist