Bug 44119 - Directory.GetFiles replaces '/' with '\' in file paths on Windows
Summary: Directory.GetFiles replaces '/' with '\' in file paths on Windows
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib (show other bugs)
Version: master
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Henric Müller
URL:
Depends on:
Blocks:
 
Reported: 2016-09-08 17:53 UTC by Jonathan Chambers
Modified: 2017-03-21 14:17 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Jonathan Chambers 2016-09-08 17:53:50 UTC
Run the following code.

.Net and Old Mono (2.6.x) outputs: <path to your temp>\SubdirForBug/file.txt

Current Mono outputs: <path to your temp>\SubdirForBug\file.txt

Note that the trailing forward slash is converted to a back slash.


// repro
using System;
using System.IO;

class Program
{
	static void Main (string[] args)
	{
		var temp = Path.GetTempPath();
		var dir = Path.Combine(temp, "SubdirForBug/");
		Directory.CreateDirectory(dir);
		File.WriteAllText(Path.Combine (dir, "file.txt"), "");
		foreach (var file in Directory.GetFiles (dir))
			Console.WriteLine (file);
	}
}

Note You need to log in before you can comment on or make changes to this bug.