[Mono-bugs] [Bug 511223] File.Exists should allow trailing slashes for file names

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Apr 15 12:31:41 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=511223

http://bugzilla.novell.com/show_bug.cgi?id=511223#c2


--- Comment #2 from Matthew Smit <zapp70 at hotmail.com> 2010-04-15 16:31:40 UTC ---
Runs as expected on 2.2 on Linux. This may have been fixed. Can anyone confirm
on Windows?

If it still doesn't work, you might try this patch. I haven't tested it though.

Index: File.cs
===================================================================
--- File.cs    (revision 153656)
+++ File.cs    (copy)


public static bool Exists (string path)
{
-    if (path == null || path.Trim().Length == 0
-    || path.IndexOfAny(Path.InvalidPathChars) >= 0) {
-        return false;
-    }

-    MonoIOError error;
+    char[] c = {'\\','/'};
+    return MonoIO.ExistsFile (path.TrimEnd(c), out error);
}

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


More information about the mono-bugs mailing list