ZlpIOHelper.DirectoryExists returns true, when i check a file with this methode!!!!

Mar 19, 2013 at 8:26 PM
Hello together,

maybe i found a bug.

I´ve created a testdirectorytree. In this directory is a file with the name ObjectParameterSample.csproj. Here the fullpath.
D:\Coding_Test\Quelle\DLL Projekt\DevLibraryDLLProjekt\bin\Debug\DevLibrary.Copy.ListCopyMoveDirectorySetInternal\Kapitel1\ObjectParameterSample\ObjectParameterSample\ObjectParameterSample.csproj

The function ZlpIOHelper.DirectoryExists(D:\Coding_Test\Quelle\DLL Projekt...ObjectParameterSample.csproj) returns true, but it´s a simple C# File, not a directory!
The funtion ZlpDirectoryInfo.GetDirectories returns the file ObjectParameterSample.csproj as a ZlpDirectoryInfo too.
When i reduce the pathlength like this D:\Coding_Test\Quelle\DLL Projekt\ObjectParameterSample.csproj, than ZlpIOHelper.DirectoryExists returns false and ZlpDirectoryInfo.GetDirectoriey ignoring ObjectParameterSample.csproj. Seems like, that the bug is dependent from the pathdepth. Can someone confirm this problem?

Greetings
Coordinator
Mar 20, 2013 at 5:53 AM
Edited Mar 20, 2013 at 5:58 AM
Hi Gibson

Just added some more Unit Tests:
[Test]
public void TestFolderVsFile()
{
    Assert.IsTrue(ZlpIOHelper.FileExists(@"c:\Windows\notepad.exe"));
    Assert.IsFalse(ZlpIOHelper.FileExists(@"c:\dslfsdjklfhsd\kjsaklfjd.exe"));
    Assert.IsFalse(ZlpIOHelper.FileExists(@"c:\Windows"));
    Assert.IsFalse(ZlpIOHelper.FileExists(@"c:\Windows\"));

    Assert.IsFalse(ZlpIOHelper.DirectoryExists(@"c:\Windows\notepad.exe"));
    Assert.IsTrue(ZlpIOHelper.DirectoryExists(@"c:\Windows"));
    Assert.IsTrue(ZlpIOHelper.DirectoryExists(@"c:\Windows\"));
    Assert.IsFalse(ZlpIOHelper.DirectoryExists(@"c:\fkjhskfsdhfjkhsdjkfhsdkjfh"));
    Assert.IsFalse(ZlpIOHelper.DirectoryExists(@"c:\fkjhskfsdhfjkhsdjkfhsdkjfh\"));
}
Which all pass successfully.

Maybe you can supply me with your sample directory structure I can use for debugging?

In addition, I've just published my newest internal version here. Maybe you can give this one a try, if it works better?
Jun 11, 2013 at 1:11 PM
Edited Jun 11, 2013 at 1:44 PM
Hello again

here an example (sorry for the late answer [to much to do :-) ])

Here an example:
private void CreateDirectory()
{
   string testPath = @"D:\Daten\Coding\_Testumgebung\Neuer Ordner\TempPE\Tools\TrueCrypt\asms\7000 \MSFT\WINDOWS\MSWINCRT\6. Diverses\ControlTemplateRetriever2\ControlTemplateRetriever2\obj\x86\Release \TempPE\Log\log4net\log4net-1.2.11\examples\mono\1.0\Repository

    ZetaLongPaths.ZlpIOHelper.CreateDirectory(testPath);
   
   ZetaPathTest zpt = new  ZetaPathTest ();
   zpt.ExistDir();
  
   // Here is popup the errormessage:
      ZetaLongPaths.ZlpIOHelper.CreateDirectory(testPath + "\\" + "SimpleApp");

  // ErrorMessage:
  /*Error 2 creating directory 'D:\Daten\Coding\_Testumgebung\Neuer Ordner\TempPE\Tools\TrueCrypt\asms\7000
  \MSFT\WINDOWS\MSWINCRT\6. Diverses\ControlTemplateRetriever2\ControlTemplateRetriever2\obj\x86\Release  \TempPE\Log\log4net\log4net-1.2.11\examples\mono\1.0\Repository\SimpleApp': Das System kann die angegebene
  Datei nicht finden.*/

 /* The strange thing is, that when i change the word "SimpleApp" to another word (example "MyTestFolder"), the  directory will be created. The errormessage will only popup, when i try to created a directory with the name "SimpleApp". I have absolute no idea why "*/
}

[TestFixture]
public class ZetaPathTest
{
  [Test]
  public void ExistDir()
  {
      string testPath = @"D:\Daten\Coding\_Testumgebung\Neuer Ordner\TempPE\Tools\TrueCrypt\asms\7000
     \MSFT\WINDOWS\MSWINCRT\6. Diverses\ControlTemplateRetriever2\ControlTemplateRetriever2\obj\x86\Release
     \TempPE\Log\log4net\log4net-1.2.11\examples\mono\1.0\Repository
     
      // Result is true!!!
      Assert.IsTrue(ZetaLongPaths.ZlpIOHelper.DirectoryExists(testPath));
  }
With greetings