[Mono-list] FileInfo.Exists() returns false after calling
FileInfo.Create()
Rathna N
NRathna@novell.com
Thu, 29 Jan 2004 07:22:07 -0700
This is a MIME message. If you are reading this text, you may want to
consider changing to a mail reader or gateway that understands how to
properly handle MIME multipart messages.
--=__Part39186D1F.0__=
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Hi,
FileInfo.Exists() returns false in the below scenario.
1. FileInfo info = new FileInfo (path);
2. AssertEquals ("test#01", false, info.Exists); //--> returns "false"
3. info.Create();
4. AssertEquals ("Exits - test#02", true, info.Exists); //--> returns
"false"
is this the expected behavior ?
CODE SNIPPET:
[Test]
public void Read(){
string TempFolder = Path.Combine (Path.GetTempPath (),
"MonoTests.System.IO.Tests");
string path = TempFolder + "/FA.Read.Test";
DeleteFile (path);
try
{
FileInfo info = new FileInfo (path);
AssertEquals ("test#01", false, info.Exists);
info.Create();
AssertEquals ("Exits - test#02", true, info.Exists);
FileStream fStream = info.Open(FileMode.Open,FileAccess.Read);
AssertEquals ("test#03", true, fStream.CanRead);
AssertEquals ("test#04", false, fStream.CanWrite);
AssertEquals ("test#05", true, fStream.CanSeek);
fStream.Close();
}
finally
{
DeleteFile (path);
}
}
thanks,
Rathna.
--=__Part39186D1F.0__=
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-2022-jp">
<META content="MSHTML 6.00.2800.1276" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Microsoft Sans Serif">
<DIV>Hi, </DIV>
<DIV>FileInfo.Exists() returns false in the below scenario.</DIV>
<DIV> </DIV>
<DIV>1. FileInfo info = new FileInfo (path);<BR>2. AssertEquals ("test#01", false, info.Exists); //--> returns "false"<BR>3. info.Create();<BR>4. AssertEquals ("Exits - test#02", true, info.Exists); //--> returns "false"<BR></DIV>
<DIV> </DIV>
<DIV>is this the expected behavior ?</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>CODE SNIPPET:</DIV>
<DIV> </DIV>
<DIV>[Test]<BR> public void Read(){</DIV>
<DIV>string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");<BR> string path = TempFolder + "/FA.Read.Test";<BR> DeleteFile (path); <BR> <BR> try <BR> {<BR> <BR> FileInfo info = new FileInfo (path);<BR> AssertEquals ("test#01", false, info.Exists);<BR> info.Create();<BR> AssertEquals ("Exits - test#02", true, info.Exists);<BR> FileStream fStream = info.Open(FileMode.Open,FileAccess.Read); <BR> AssertEquals ("test#03", true, fStream.CanRead);<BR> AssertEquals ("test#04", false, fStream.CanWrite);<BR> AssertEquals ("test#05", true, fStream.CanSeek);<BR> fStream.Close();<BR> } <BR> finally <BR> {<BR> DeleteFile (path);<BR> }<BR> } </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>thanks,</DIV>
<DIV>Rathna.</DIV></BODY></HTML>
--=__Part39186D1F.0__=--