[Mono-bugs] [Bug 346123] New: [Linux] File and directory names with backslashes are trimmed

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Dec 5 04:15:40 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=346123


           Summary: [Linux] File and directory names with backslashes are
                    trimmed
           Product: Mono: Runtime
           Version: 1.2.6
          Platform: All
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: io-layer
        AssignedTo: dick at novell.com
        ReportedBy: gert.driesen at pandora.be
         QAContact: mono-bugs at ximian.com
          Found By: ---


Apparently, Directory.GetFiles and Directory.GetDirectories strips the part of
the file or directory name before the backslash.

To reproduce, compile and run the following code:

using System;
using System.IO;

class Program
{
  static void Main ()
  {
    string root = Path.Combine (AppDomain.CurrentDomain.BaseDirectory,
                                "test");
    if (Directory.Exists (root))
      Directory.Delete (root, true);
    Directory.CreateDirectory (root);

    string file = Path.Combine (root, @"doc\temp1.file");
    File.Create (file).Close ();

    string [] files = Directory.GetFiles (root);
    Console.WriteLine ("A1: " + (files.Length == 1));
    Console.WriteLine ("A2: " + files [0]);

    string dir = Path.Combine (root, @"sub\dir");
    Directory.CreateDirectory (dir);

    string [] dirs = Directory.GetDirectories (root);
    Console.WriteLine ("B1: " + (dirs.Length == 1));
    Console.WriteLine ("B2: " + dirs [0]);
  }
}

Expected result:

A1: True
A2: .../test/doc\temp1.file
B1: True
B2: .../test/sub\dir

Actual result:

Expected result:

A1: True
A2: .../test/temp1.file
B1: True
B2: .../test/dir


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list