From 8afa897776c8c8c42a254ebf8c5d9e11a1c3f28d Mon Sep 17 00:00:00 2001 From: Nefo Fortressia Date: Thu, 11 Nov 2021 07:32:14 +0700 Subject: [PATCH] fix: fix not defined errors in recursive_add_files_into_tree_store() recursive_add_files_into_tree_store() tried to refer to 'filepath', which is not defined. Use the parent_file's path to replace 'filepath'. The function also tried to refer to 'files', which is also not defined. Seems to be a typo of 'child_files'. --- src/components/window/workspace.rs | 45 ++++++++++++++---------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/src/components/window/workspace.rs b/src/components/window/workspace.rs index 7668350..3462051 100644 --- a/src/components/window/workspace.rs +++ b/src/components/window/workspace.rs @@ -121,31 +121,28 @@ impl WorkspaceImplementedEditor for EchidnaWindow { } } -/** - * - * - */ -fn recursive_add_files_into_tree_store(&self, parent_file: File, tree: &TreeStore) { - let child_enumerate_cancellable = Cancellable::new(); - let child_files = parent_file - .enumerate_children( - "*", - FileQueryInfoFlags::NONE, - Some(&child_enumerate_cancellable), - ) - .expect( - format!( - "Could not look up the children files of {:?} because:\n{:#?}", - filepath + /** + * + * + */ + fn recursive_add_files_into_tree_store(&self, parent_file: File, tree: &TreeStore) { + let child_enumerate_cancellable = Cancellable::new(); + + let child_files = parent_file + .enumerate_children( + "*", + FileQueryInfoFlags::NONE, + Some(&child_enumerate_cancellable), ) - .as_str(), - ); - let filepath = &parent_file - .path() - .expect("Could not get the file path of the file."); - - for file_iter in files { - let file_info = file_iter.expect(); + .expect( + format!( + "Could not look up the children files of {:?} because:", + parent_file.path().expect("No path for the parent file") + ) + .as_str(), + ); + for file_iter in child_files { + let file_info = file_iter.expect("Could not get the file info"); let file = parent_file.child(file_info.name()); let tree_iter = tree.append(None); tree.set_value(&tree_iter, 2, &file_info.name().to_str().to_value());