From ecc975f035c4ced952c71ef34065371c491f3514 Mon Sep 17 00:00:00 2001 From: Marcos Henrich Date: Wed, 16 Mar 2016 10:07:06 +0000 Subject: [PATCH] [corlib] Fix FileInfo.ToString after MoveTo Fixes #38796 --- mcs/class/corlib/System.IO/FileInfo.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mcs/class/corlib/System.IO/FileInfo.cs b/mcs/class/corlib/System.IO/FileInfo.cs index 1e53bade58f..69e1f32ffdd 100644 --- a/mcs/class/corlib/System.IO/FileInfo.cs +++ b/mcs/class/corlib/System.IO/FileInfo.cs @@ -48,6 +48,7 @@ namespace System.IO { public sealed class FileInfo : FileSystemInfo { private bool exists; + private string displayPath; public FileInfo (string fileName) { @@ -59,11 +60,14 @@ namespace System.IO { OriginalPath = fileName; FullPath = Path.GetFullPath (fileName); + + displayPath = OriginalPath; } private FileInfo (SerializationInfo info, StreamingContext context) : base (info, context) { + displayPath = OriginalPath; } internal override void InternalRefresh () @@ -241,6 +245,8 @@ namespace System.IO { File.Move (FullPath, destFullPath); this.FullPath = destFullPath; + + displayPath = destFileName; } public FileInfo CopyTo (string destFileName) @@ -267,7 +273,7 @@ namespace System.IO { public override string ToString () { - return OriginalPath; + return displayPath; } #if !MOBILE -- 2.25.1