Permalink
Browse files

Fixed 'Add Folder Access To Path Bug'

Added an try .. empty catch around the code which requests the files. I'm not sure if we should display an error message if this exception occurs.
  • Loading branch information...
1 parent 8b32c02 commit 0b45b5d79aff4d1fd66b3b845dec75fcdeba781d @marklagendijk committed Dec 19, 2012
Showing with 15 additions and 11 deletions.
  1. +15 −11 WinLess/Models/Directory.cs
View
26 WinLess/Models/Directory.cs
@@ -97,22 +97,26 @@ public override string ToString()
private void AddFiles(DirectoryInfo directoryInfo)
{
- FileInfo[] files = directoryInfo.GetFiles();
- foreach (FileInfo file in files)
+ try
{
- if ((string.Compare(file.Extension, ".less", StringComparison.InvariantCultureIgnoreCase) == 0 ||
- (string.Compare(file.Extension, ".css", StringComparison.InvariantCultureIgnoreCase) == 0) && file.Name.Contains(".less")
- ) && !this.ContainsFile(file.FullName))
+ FileInfo[] files = directoryInfo.GetFiles();
+ foreach (FileInfo file in files)
{
- Files.Add(new Models.File(this, file.FullName));
+ if ((string.Compare(file.Extension, ".less", StringComparison.InvariantCultureIgnoreCase) == 0 ||
+ (string.Compare(file.Extension, ".css", StringComparison.InvariantCultureIgnoreCase) == 0) && file.Name.Contains(".less")
+ ) && !this.ContainsFile(file.FullName))
+ {
+ Files.Add(new Models.File(this, file.FullName));
+ }
}
- }
- DirectoryInfo[] subDirectories = directoryInfo.GetDirectories();
- foreach (DirectoryInfo subDirectoryInfo in subDirectories)
- {
- AddFiles(subDirectoryInfo);
+ DirectoryInfo[] subDirectories = directoryInfo.GetDirectories();
+ foreach (DirectoryInfo subDirectoryInfo in subDirectories)
+ {
+ AddFiles(subDirectoryInfo);
+ }
}
+ catch{}
}
#endregion

0 comments on commit 0b45b5d

Please sign in to comment.