Re: Path-related asserts
"Daniel M. Pomerantz" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.devel |
|---|---|
| Message-ID | <[email protected]> |
To continue down the path (no pun intended) of case sensitivity in paths
in .Net, I came across the following while doing some work for my job.
Thought it applied and should be shared:
In the .Net 2.0 and 3.5 MSDN documentations, I found the following blurb
related to System.IO.Directory.Exists(string path) and
System.IO.Directory.Delete(string path):
"The path parameter is not case-sensitive."
System.IO.Directory.CreateDirectory(string path), System.IO.File.Create,
System.IO.File.Exists, and System.IO.File.Delete have no such blurb in
their documentation. This leads me to believe that Microsoft envisioned
.Net to always be case preserving on the creation of directories, but
always case insensitive in working with directories.....which leaves me
to believe that as per the documentation, the path / directory asserts
that we have discussed should always be case-insensitive regardless of
the OS or the FS in play. Please note that I am not saying that I agree
with this implementation, but to me, documentation is gospel.
I am curious for how this is implemented on OSes and FSes which are case
sensitive. When running mono on a linux box, accessing an ext3 fs, if
the directories /etc/foo/bar and /etc/FOO exist, what what will be the
result of calling Directory.Exists("/etc/FOO/bar")? What will happen if
some one calls "Directory.Delete("/etc/foo", true)" ? I feel that this
needs to be resolved...by the mono team.
This is all made even more complicated by the fact that File doesn't
have the blurb, and paths are a completely different animal: Directory
and File are meant to actually interact with a FS, and Path is all
intended to be theoretical. In looking at the documentation for Path a
bit closer, I found no case specific data, but did find the following:
"Because all these operations are performed on strings, it is impossible
to verify that the results are valid in all scenarios."
My (hopefully final) thoughts on the matter:
This should be clarified with Microsoft. The documentation and intent
in this area is not clear: Are all or no paths case sensitive?
NUnit should pick a standard and use it throughout. The objects at the
heart of this appear to either be ambiguous or documented as case
insensitive. That leads me to believe that the best way to adhere to
the documentation is to be case insensitive.
If NUnit wishes to have an option, I can understand, but the default
behaviour of the framework (case in-sensitivity) should be the default
behaviour of the Asserts.
Sorry if these appears to be beating a dead horse or repeating already
stated opinions, I just thought that this shed a new light on the matter.
dmp
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/