diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-07-29 18:53:32 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2014-07-29 18:53:32 +0400 |
commit | c59dc6917bb11b66c68063c7c5eb73cf8b51982c (patch) | |
tree | 12c147ef12af6b9cf0c7338a1a22a5dc21804191 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs | |
parent | a4d8bd1db31139f4b5eb1c0c90aa1041b6407247 (diff) |
[Ide] Allow changing the case of folder names
Fixes bug #4186 - Cannot change the Case of folder names in OS-X
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 | 20 |
1 files changed, 15 insertions, 5 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 88b8be8058..74fe723cbb 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 @@ -159,13 +159,23 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad try { if (!FileService.IsValidPath (newFoldername)) { MessageService.ShowWarning (GettextCatalog.GetString ("The name you have chosen contains illegal characters. Please choose a different name.")); - } else if (File.Exists (newFoldername) || Directory.Exists (newFoldername)) { + return; + } + if (File.Exists (newFoldername)) { MessageService.ShowWarning (GettextCatalog.GetString ("File or directory name is already in use. Please choose a different one.")); - } else { - FileService.RenameDirectory (oldFoldername, newName); - if (folder.Project != null) - IdeApp.ProjectOperations.Save (folder.Project); + return; } + // Don't use Directory.Exists because we want to check for the exact case in case-insensitive file systems + var di = Directory.GetDirectories (Path.GetDirectoryName (newFoldername), Path.GetFileName (newFoldername)).FirstOrDefault (); + if (di != null) { + MessageService.ShowWarning (GettextCatalog.GetString ("File or directory name is already in use. Please choose a different one.")); + return; + } + + FileService.RenameDirectory (oldFoldername, newName); + if (folder.Project != null) + IdeApp.ProjectOperations.Save (folder.Project); + } catch (System.ArgumentException) { // new file name with wildcard (*, ?) characters in it MessageService.ShowWarning (GettextCatalog.GetString ("The name you have chosen contains illegal characters. Please choose a different name.")); } catch (System.IO.IOException ex) { |