Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorDavid Karlaš <david.karlas@microsoft.com>2019-11-25 19:39:17 +0300
committerGitHub <noreply@github.com>2019-11-25 19:39:17 +0300
commit3d8291d3bc0390b9a2a7f17302d9459dbb41eada (patch)
tree26a03679ab7a5d76b87540d41971401e5f2ad244 /main
parent8af80e762c1b0aeb67d20bab988ec6139c5f955f (diff)
parent59ec8285eba5b26b8a2a8f441c66a144d765048e (diff)
Merge pull request #9347 from mono/dev/davkar/fix1023494
Fix 1023494: Unsaved new documents have `/` added to begining of file name
Diffstat (limited to 'main')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/FileDocumentController.cs7
-rw-r--r--main/tests/Ide.Tests/MonoDevelop.Ide.Gui.Documents/DocumentManagerTests.cs9
2 files changed, 15 insertions, 1 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/FileDocumentController.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/FileDocumentController.cs
index 2ecfd021c1..194903f7ec 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/FileDocumentController.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/FileDocumentController.cs
@@ -25,6 +25,7 @@
// THE SOFTWARE.
using System;
+using System.IO;
using System.Threading.Tasks;
using MonoDevelop.Core;
using System.Text;
@@ -57,7 +58,11 @@ namespace MonoDevelop.Ide.Gui.Documents
}
set {
if (value != filePath) {
- filePath = value.CanonicalPath;
+ if (Path.IsPathRooted(value)) {
+ filePath = value.CanonicalPath;
+ } else {
+ filePath = value;
+ }
defaultMimeType = null;
OnFileNameChanged ();
diff --git a/main/tests/Ide.Tests/MonoDevelop.Ide.Gui.Documents/DocumentManagerTests.cs b/main/tests/Ide.Tests/MonoDevelop.Ide.Gui.Documents/DocumentManagerTests.cs
index de8f82579e..694bc23b5b 100644
--- a/main/tests/Ide.Tests/MonoDevelop.Ide.Gui.Documents/DocumentManagerTests.cs
+++ b/main/tests/Ide.Tests/MonoDevelop.Ide.Gui.Documents/DocumentManagerTests.cs
@@ -231,6 +231,15 @@ namespace MonoDevelop.Ide.Gui.Documents
}
[Test]
+ public async Task NewDocumentFileNameMayNotChange ()
+ {
+ const string newName = "SomeFileName.txt";
+ var doc = await documentManager.NewDocument (newName, "text/plain", "");
+ //Since this is just "unsaved/new" file, its expected that Name and FileName are matching
+ Assert.AreEqual (doc.Name, doc.FileName.ToString ());
+ }
+
+ [Test]
public async Task GetDocument ()
{
documentControllerService.RegisterFactory (new TestFileControllerFactory ());