infomaniac50 / dokan

Automatically exported from code.google.com/p/dokan
0 stars 1 forks source link

Delete Directory - Recursion problems #169

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
a)
1. Mount drive
2. Create an empty directory
3. Delete empty directory with "recursive" set to true 

b)
1. Mount drive
2. Create a direcory
3. Create a file in the directory
4. Delete the directory with "recursive" set to false

What is the expected output? What do you see instead?

a)
Expected: Directory is deleted
Output: IOFileNotFound Exception

b)
Expected: Some sort of error message. Directory not empty
Output: Directory is deleted!

What version of the product are you using? On what operating system?
Vista 32bit, dokan-0.5.3, net-0.3.0
Visual Studio 2010 Express

Please provide any additional information below.

C#-code:

a)
Directory.CreateDirectory("z:\\mydir");
Directory.Delete("z:\\mydir", true); // <-- error

b)
Directory.CreateDirectory("z:\\mydir");
File.Create("z:\\mydir\\myfile.txt").Close();
Directory.Delete("z:\\mydir", false); // <-- no error

Original issue reported on code.google.com by tokeboy.riis on 30 Jul 2010 at 9:16

GoogleCodeExporter commented 9 years ago
Done a little more investigation... 

b) 
looks like I've misunderstood the .net-interface, as DeleteDirectory apparently 
_shouldn't_ delete anything. I interpreted the function as force-delete 
directory, empty or not.

The directory is now deleted with the Close-function as I guess was intended 
(Documentation really needs a brush-up at some time :-) ).

We do however miss a "DokanNet.ERROR_DIRECTORY_IS_NOT_EMPTY" ( I now return 
-145, which is the Windows error code. )

a) still gives headaches - I do think it's a minor bug in the .NET binding. 
These are the calls made to my dokan-implementation:

CreateFile <dirname> (Open)
GetFileInformation <dirname>
GetFileInformation <dirname>
GetFileInformation <dirname>
CloseFile <dirname>
OpenDirectory <dirname>
FindFiles <dirname>  
CloseFile <dirname>

FindFiles returns an empty array, which I guess is the cause of the error...

Keep up the extremely good work! Dokan rulez!

Original comment by tokeboy.riis on 31 Jul 2010 at 12:01

GoogleCodeExporter commented 9 years ago
Bug finally found for a);

FindFiles should not return an empty array. It should return parent ("..") and 
self ("."). That wasn't obvious!

Original comment by tokeboy.riis on 5 Dec 2010 at 2:38