Browse Source

Fixed SD2-893 - Searching text in a directory with no access permissions throws exception

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4460 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 16 years ago
parent
commit
db3f066b73
  1. 6
      src/AddIns/Misc/SearchAndReplace/Project/Engine/SearchReplaceManager.cs
  2. 5
      src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs

6
src/AddIns/Misc/SearchAndReplace/Project/Engine/SearchReplaceManager.cs

@ -171,7 +171,8 @@ namespace SearchAndReplace
ShowNotFoundMessage(monitor); ShowNotFoundMessage(monitor);
} else { } else {
if (monitor != null) monitor.ShowingDialog = true; if (monitor != null) monitor.ShowingDialog = true;
MessageService.ShowMessage("${res:ICSharpCode.TextEditor.Document.SearchReplaceManager.MarkAllDone}", "${res:Global.FinishedCaptionText}"); MessageService.ShowMessage(StringParser.Parse("${res:ICSharpCode.TextEditor.Document.SearchReplaceManager.MarkAllDone}", new string[,]{{ "Count", count.ToString() }}),
"${res:Global.FinishedCaptionText}");
if (monitor != null) monitor.ShowingDialog = false; if (monitor != null) monitor.ShowingDialog = false;
} }
} }
@ -182,7 +183,8 @@ namespace SearchAndReplace
ShowNotFoundMessage(monitor); ShowNotFoundMessage(monitor);
} else { } else {
if (monitor != null) monitor.ShowingDialog = true; if (monitor != null) monitor.ShowingDialog = true;
MessageService.ShowMessage("${res:ICSharpCode.TextEditor.Document.SearchReplaceManager.ReplaceAllDone}", "${res:Global.FinishedCaptionText}"); MessageService.ShowMessage(StringParser.Parse("${res:ICSharpCode.TextEditor.Document.SearchReplaceManager.ReplaceAllDone}", new string[,]{{ "Count", count.ToString() }}),
"${res:Global.FinishedCaptionText}");
if (monitor != null) monitor.ShowingDialog = false; if (monitor != null) monitor.ShowingDialog = false;
} }
} }

5
src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs

@ -318,6 +318,7 @@ namespace ICSharpCode.Core
{ {
// If Directory.GetFiles() searches the 8.3 name as well as the full name so if the filemask is // If Directory.GetFiles() searches the 8.3 name as well as the full name so if the filemask is
// "*.xpt" it will return "Template.xpt~" // "*.xpt" it will return "Template.xpt~"
try {
bool isExtMatch = Regex.IsMatch(filemask, @"^\*\..{3}$"); bool isExtMatch = Regex.IsMatch(filemask, @"^\*\..{3}$");
string ext = null; string ext = null;
string[] file = Directory.GetFiles(directory, filemask); string[] file = Directory.GetFiles(directory, filemask);
@ -341,6 +342,10 @@ namespace ICSharpCode.Core
SearchDirectory(d, filemask, collection, searchSubdirectories, ignoreHidden); SearchDirectory(d, filemask, collection, searchSubdirectories, ignoreHidden);
} }
} }
} catch (UnauthorizedAccessException) {
// Ignore exception when access to a directory is denied.
// Fixes SD2-893.
}
} }
// This is an arbitrary limitation built into the .NET Framework. // This is an arbitrary limitation built into the .NET Framework.

Loading…
Cancel
Save