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
diff options
context:
space:
mode:
authorMarius Ungureanu <marius.ungureanu@xamarin.com>2016-04-18 19:26:14 +0300
committerMarius Ungureanu <marius.ungureanu@xamarin.com>2016-04-18 19:26:14 +0300
commit5c07ce51b17367a144b703573db93c19b51eb997 (patch)
tree11d8dd1c77c08763fe48b066259df7af3be80219 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad
parentb8075022fd33bea58c39beba1d3b5335b8933b87 (diff)
[Ide] Allow changing the case of a project file.
Adds the patch from Matt on bug35655.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs
index 8142f496d2..a3cb32a7bb 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs
@@ -181,7 +181,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
if (!FileService.IsValidPath (newPath) || ProjectFolderCommandHandler.ContainsDirectorySeparator (newName)) {
MessageService.ShowWarning (GettextCatalog.GetString ("The name you have chosen contains illegal characters. Please choose a different name."));
- } else if ((newProjectFile != null && newProjectFile != file) || File.Exists (file.FilePath.ParentDirectory.Combine (newName))) {
+ } else if ((newProjectFile != null && newProjectFile != file) || FileExistsCaseSensitive (file.FilePath.ParentDirectory, newName)) {
// If there is already a file under the newPath which is *different*, then throw an exception
MessageService.ShowWarning (GettextCatalog.GetString ("File or directory name is already in use. Please choose a different one."));
} else {
@@ -195,6 +195,15 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
MessageService.ShowError (GettextCatalog.GetString ("There was an error renaming the file."), ex);
}
}
+
+ static bool FileExistsCaseSensitive (FilePath parentDirectory, string fileName)
+ {
+ if (!Directory.Exists (parentDirectory))
+ return false;
+
+ return Directory.GetFiles (parentDirectory, fileName)
+ .Any (file => Path.GetFileName (file) == fileName);
+ }
public override void ActivateItem ()
{