Skip to content

Commit

Permalink
fix: windows recursion issue
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed Nov 2, 2024
1 parent 93a968b commit 70b5b85
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions remotefs-fuse/src/driver/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,25 +370,27 @@ where
}

/// Find files at path with the optional pattern.
fn find_files(
&self,
ctx: &File,
pattern: Option<&U16CStr>,
fill: impl FnMut(&FindData) -> FillDataResult,
) -> OperationResult<()> {
fn find_files<F>(&self, ctx: &File, pattern: Option<&U16CStr>, fill: F) -> OperationResult<()>
where
F: FnMut(&FindData) -> FillDataResult,
{
if ctx.is_file() {
return Err(STATUS_NOT_A_DIRECTORY);
}
self.find_files_acc(ctx.path(), pattern, fill)?;

self.find_files_acc(ctx.path(), pattern, fill)
Ok(())
}

fn find_files_acc(
fn find_files_acc<F>(
&self,
p: &Path,
pattern: Option<&U16CStr>,
mut acc: impl FnMut(&FindData) -> FillDataResult,
) -> OperationResult<()> {
mut acc: F,
) -> OperationResult<F>
where
F: FnMut(&FindData) -> FillDataResult,
{
debug!("find_files_acc({p:?}, {pattern:?})");

// list directory
Expand Down Expand Up @@ -419,10 +421,10 @@ where

// iter dirs
for dir in dirs {
self.find_files_acc(dir.path(), pattern, &mut acc)?;
acc = self.find_files_acc(dir.path(), pattern, acc)?;
}

Ok(())
Ok(acc)
}

fn find_data(file: &File) -> FindData {
Expand Down

0 comments on commit 70b5b85

Please sign in to comment.