diff options
author | Matt Ward <matt.ward@xamarin.com> | 2016-01-12 20:09:49 +0300 |
---|---|---|
committer | Matt Ward <matt.ward@xamarin.com> | 2016-01-12 20:36:49 +0300 |
commit | 0269e49b2df262b86d67ba73d61344f6c9b3ec3c (patch) | |
tree | a31b93d74639cdcd28195173c3789c745a3a47aa /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs | |
parent | d0219f2eb04404c405a4f85489f151372a055968 (diff) |
[Ide] Handle directory separator chars when renaming files and folders
Fixed bug #37309 - Creating project new folder with '\' at the end
of name causes endless loop recursion
https://bugzilla.xamarin.com/show_bug.cgi?id=37309
If a folder is renamed and a '\' char is used at the end then on
Windows the folder would be renamed and the Solutions window would
show a folder item that could be expanded repeatedly, with the same
folder inside it. Closing and re-opening the solution fixes the
problem. If a directory separator character is used in the middle of
the folder name then an error occurs when an attempt is made to create
the directory.
Now when renaming a file or a folder if a directory separator char
is used then a message will be displayed indicating that the name is
invalid. This is already handled with projects, solutions and
workspaces in the Solution window. Now it is also handled with files
and folders.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs index 89bc9dbf4b..ebe5b7fd6a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs @@ -151,7 +151,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad if (oldFoldername != newFoldername) { try { - if (!FileService.IsValidPath (newFoldername)) { + if (!FileService.IsValidPath (newFoldername) || ContainsDirectorySeparator (newName)) { MessageService.ShowWarning (GettextCatalog.GetString ("The name you have chosen contains illegal characters. Please choose a different name.")); return; } @@ -177,7 +177,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad } } } - +
public override void DeleteMultipleItems () { var projects = new Set<SolutionItem> (); @@ -370,6 +370,10 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad return true; return false; } - + + internal static bool ContainsDirectorySeparator (string name) + { + return name.Contains (Path.DirectorySeparatorChar) || name.Contains (Path.AltDirectorySeparatorChar); + } } } |