tags:

views:

100

answers:

3

Let me rephrase. My example probably wasn't good. A lot of things can go wrong when deleting a directory. A file has a readonly attribute set, the directory is opened by the windows explorer. I guess all of them can be handled - however I don't want to do it on my own - is there a wrapper that takes care of that with a simple api?

I find the file system operations in System.IO inadequate. For example, in case a file is opened in a text editor the file can't be saved.

I wondered if there is a more powerful implementation of file system for .net?

+3  A: 

which text editor? How are you opening the file for writing? I write to log file all the time and don't have this problem.

Seems a bit rash to abandon System.IO for that reason.

Adrian
+2  A: 

It doesn't matter what you use, you can't write to a file that is locked.

This is not a limitation of the .NET framework, this is how the file system works.

Guffa
+1  A: 

Almost all of the System.IO calls are just wrappers to kernel32.dll. The enums being sent across are analogous to the ones from the pinvoked kernel32 ones, so:

System.IO.File.Create(@"C:\test.txt",1024,FileOptions.Asynchronous)

Which uses a FileStream, uses kernel32's WriteFile

Chris S