From bd6c24a92f4ac01625f73adac075c90c36e3f74a Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Wed, 8 Jan 2025 10:00:53 +1300 Subject: 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. --- src/operations/ls.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/operations/ls.rs') 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) -> ReadResult>{ 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, }; -- cgit v1.2.3-70-g09d2