[Mono-list] Possible bug checking existence of file or directory

Stifu stifu at free.fr
Fri Nov 5 05:27:59 EDT 2010


"Doing File.Exists() or Directory.Exists() on a file / dir that the
running account doesn't have permission to causes this to return
false.  This is somewhat understandable (but is it correct?)."

This matches what MSDN says.

"Return Value
true if the caller has the required permissions and path contains the name
of an existing file; otherwise, false."

http://msdn.microsoft.com/en-us/library/system.io.file.exists%28v=VS.80%29.aspx

I'm not sure about FileSystemWatcher throwing DirectoryNotFoundException,
though.

MSDN doesn't mention it (if we're indeed talking about the FileSystemWatcher
constructor): http://msdn.microsoft.com/en-us/library/b36854c3.aspx


Abe Gillespie wrote:
> 
> If this is a bug I'll file it:
> 
> Doing File.Exists() or Directory.Exists() on a file / dir that the
> running account doesn't have permission to causes this to return
> false.  This is somewhat understandable (but is it correct?).
> However, doing a new FileSystemWatcher() on the same existing, but not
> accessible dir, throws a DirectoryNotFoundException().  This seems a
> little less understandable.  But I'm not sure.
> 
> -Abe
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 
> 

-- 
View this message in context: http://mono.1490590.n4.nabble.com/Possible-bug-checking-existence-of-file-or-directory-tp3028067p3028357.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list