Add symlinks to the database

This commit is contained in:
Ajeet D'Souza 2024-09-13 05:44:35 +05:30
parent c1d7c4f4c7
commit 450433644f
2 changed files with 6 additions and 1 deletions

View File

@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- fish: `cd` command is now copied directly from
`$__fish_data_dir/functions/cd.fish`. This should minimize the chances of an
infinite loop when aliasing `cd=z`.
- Symlinks not getting added to the database when `$_ZO_RESOLVE_SYMLINKS=0`.
## [0.9.4] - 2024-02-21

View File

@ -83,8 +83,12 @@ impl<'a> Stream<'a> {
if !self.options.exists {
return true;
}
// The logic here is reversed - if we resolve symlinks when adding entries to
// the database, we should not return symlinks when querying back from
// the database.
let resolver =
if self.options.resolve_symlinks { fs::metadata } else { fs::symlink_metadata };
if self.options.resolve_symlinks { fs::symlink_metadata } else { fs::metadata };
resolver(path).map(|metadata| metadata.is_dir()).unwrap_or_default()
}
}