refactoring and work on file search
This commit is contained in:
parent
4def21c97d
commit
7f2685d328
9 changed files with 181 additions and 155 deletions
21
src-tauri/src/search.rs
Normal file
21
src-tauri/src/search.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
pub fn search_files(searchstring: &str, filter: Vec<&str>) -> HtmlTag{
|
||||
|
||||
if let Ok(entries) = fs::read_dir(path) {
|
||||
for dir_entry_res in entries {
|
||||
if let Ok(dir_entry) = dir_entry_res {
|
||||
if let Ok(metadata) = fs::metadata(dir_entry.path()) {
|
||||
if metadata.is_file() {
|
||||
html.add_child(div_from_dir_entry(&dir_entry))
|
||||
} else if metadata.is_dir() {
|
||||
html.add_child(
|
||||
add_dir_tree_node(&dir_entry.path(), &filter)
|
||||
.with_attribute("style", "visibility: hidden; height: 0px;"), // .with_style("visibility", "hidden")
|
||||
// .with_style("height", "0px"),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue