From 3ad889f7241375e1500674aeb8b36c630517f743 Mon Sep 17 00:00:00 2001 From: trivernis Date: Tue, 9 Nov 2021 19:27:09 +0100 Subject: [PATCH] Fix iterative folder resolving algorithm Signed-off-by: trivernis --- mediarepo-api/src/tauri_plugin/commands/file.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mediarepo-api/src/tauri_plugin/commands/file.rs b/mediarepo-api/src/tauri_plugin/commands/file.rs index 538c92f..b46f295 100644 --- a/mediarepo-api/src/tauri_plugin/commands/file.rs +++ b/mediarepo-api/src/tauri_plugin/commands/file.rs @@ -157,7 +157,9 @@ async fn resolve_path_to_files(path: PathBuf) -> PluginResult PluginResult> { let mut entries = vec![entry]; - for i in 0..entries.len() { + let mut i = 0; + + while i < entries.len() { let entry = &entries[i]; if entry.path().is_dir() { @@ -166,6 +168,7 @@ async fn resolve_subdir(entry: DirEntry) -> PluginResult> { entries.push(entry); } } + i += 1; } Ok(entries)