diff options
| author | Ben Bridle <bridle.benjamin@gmail.com> | 2025-01-08 10:00:53 +1300 |
|---|---|---|
| committer | Ben Bridle <bridle.benjamin@gmail.com> | 2025-01-08 10:00:53 +1300 |
| commit | bd6c24a92f4ac01625f73adac075c90c36e3f74a (patch) | |
| tree | 772ac85486c422c20a5e25dcff3bf9b9c63ee7be | |
| parent | 08f3153fea62ea81a42438347eeee058f5bec199 (diff) | |
| download | vagabond-bd6c24a92f4ac01625f73adac075c90c36e3f74a.zip | |
Preserve original path when listing directory contents
Previously, the value of the original_path field of each entry returned
by the list_directory function was using the canonicalized directory
path, not the directory path as originally passed to the function.
| -rw-r--r-- | src/operations/ls.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/operations/ls.rs b/src/operations/ls.rs index 9dd3258..afb0f18 100644 --- a/src/operations/ls.rs +++ b/src/operations/ls.rs @@ -23,7 +23,8 @@ pub fn list_directory(path: impl AsRef<Path>) -> ReadResult<Vec<Entry>>{ let mut entries = Vec::new(); for dir_entry in raise!(std::fs::read_dir(path)) { - let entry = match Entry::from_path(&raise!(dir_entry).path()) { + let entry_path = path.join(raise!(dir_entry).file_name()); + let entry = match Entry::from_path(entry_path) { Ok(v) => v, Err(_) => continue, }; |
