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'.
merge-requests/12/head
Nefo Fortressia 2021-11-11 07:32:14 +07:00
parent cc6d331670
commit 8afa897776
Signed by: fortressia
GPG Key ID: 6D7972CC76174995
1 changed files with 21 additions and 24 deletions

View File

@ -121,31 +121,28 @@ impl WorkspaceImplementedEditor for EchidnaWindow {
} }
} }
/** /**
* *
* *
*/ */
fn recursive_add_files_into_tree_store(&self, parent_file: File, tree: &TreeStore) { fn recursive_add_files_into_tree_store(&self, parent_file: File, tree: &TreeStore) {
let child_enumerate_cancellable = Cancellable::new(); let child_enumerate_cancellable = Cancellable::new();
let child_files = parent_file
.enumerate_children( let child_files = parent_file
"*", .enumerate_children(
FileQueryInfoFlags::NONE, "*",
Some(&child_enumerate_cancellable), FileQueryInfoFlags::NONE,
) Some(&child_enumerate_cancellable),
.expect(
format!(
"Could not look up the children files of {:?} because:\n{:#?}",
filepath
) )
.as_str(), .expect(
); format!(
let filepath = &parent_file "Could not look up the children files of {:?} because:",
.path() parent_file.path().expect("No path for the parent file")
.expect("Could not get the file path of the file."); )
.as_str(),
for file_iter in files { );
let file_info = file_iter.expect(); 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 file = parent_file.child(file_info.name());
let tree_iter = tree.append(None); let tree_iter = tree.append(None);
tree.set_value(&tree_iter, 2, &file_info.name().to_str().to_value()); tree.set_value(&tree_iter, 2, &file_info.name().to_str().to_value());