[Mono-bugs] [Bug 521924] New: Path.GetFullPath trims white spaces before files and directories names on Windows
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue Jul 14 08:09:20 EDT 2009
http://bugzilla.novell.com/show_bug.cgi?id=521924
Summary: Path.GetFullPath trims white spaces before files and
directories names on Windows
Classification: Mono
Product: Mono: Class Libraries
Version: unspecified
Platform: Other
OS/Version: Windows
Status: NEW
Severity: Normal
Priority: P5 - None
Component: CORLIB
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: salo3 at atlas.cz
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Description of Problem:
In this example Path.GetFullPath(" test.txt") returns "C:\test.txt" instead of
"C:\ test.txt" (on Windows):
using System;
using System.IO;
namespace Test
{
class Program
{
static void Main(string[] args)
{
string file = " test.txt";
FileStream fs = File.Create(file);
fs.Close();
bool ret = File.Exists(Path.GetFullPath(file));
Console.WriteLine(ret);
}
}
}
Actual Results:
example program returns false
Expected Results:
example program should return true just like in .NET
How often does this happen?
100%
Additional Information:
I assume that the problem is in function Path.CanonicalizePath - Path.cs lines
668 - 670:
// WIN32 path components must be trimmed
if (Environment.IsRunningOnWindows)
dirs[i] = dirs[i].Trim ();
and that only TrimEnd should be used.
--
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