dokan-rust icon indicating copy to clipboard operation
dokan-rust copied to clipboard

`find_files_with_pattern` must be implemented

Open inetic opened this issue 2 years ago • 1 comments

It's my understanding that in C the function pointer to find_files_with_pattern may be left unset. However the rust wrapper implements its default implementation here.

Problem is this: The C code uses find_files here to get the content of the directory. Then it gets here, then here, then here and finally ends up in MatchFiles.

In MatchFiles it checks whether FindFilesWithPattern is set, which it is and thus patternCheck is NOT set to TRUE.

Because of that this condition always passes on the first entry that find_files returns.

This bug can be reproduced with your memfs example:

  1. mount the fs
  2. create some number of files in it: f1.txt, f2.txt, f3.txt, f4.txt
  3. select one of the files, say f3.txt
  4. press the Del button
  5. a dialog appears asking whether you want to delete a file. This file will likely not be f3.txt (if it is, try with another file)

inetic avatar May 10 '23 17:05 inetic

After some thinking, this would probably be best to fix in the C code. I reported the issue here. If you agree than feel free to close this one.

Additionally, I worked around the issue by implementing find_files_with_pattern with the help of the is_name_in_expression support function.

inetic avatar May 11 '23 09:05 inetic