Changeset 1662


Ignore:
Timestamp:
1/25/2010 3:01:45 AM (4 years ago)
Author:
lowjoel
Message:

Fixed regression in r1102: the check on Exists ensures that the DirectoryNotFoundException? will not be raised -- however, it doesn't guard against UnauthorizedAccessException?, so we should be guarding against that instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser6/Eraser.Manager/Task.cs

    r1515 r1662  
    718718            if (info.Exists) 
    719719            { 
    720                 foreach (DirectoryInfo dir in info.GetDirectories()) 
    721                     try 
    722                     { 
     720                try 
     721                { 
     722                    foreach (DirectoryInfo dir in info.GetDirectories()) 
    723723                        result.AddRange(GetFiles(dir)); 
    724                     } 
    725                     catch (DirectoryNotFoundException e) 
    726                     { 
    727                         //Ignore, but log. 
    728                         Task.Log.LastSessionEntries.Add(new LogEntry(S._("Could not erase {0} because {1}", 
    729                             dir.FullName, e.Message), LogLevel.Error)); 
    730                     } 
    731  
    732                 if (IncludeMask.Length == 0) 
    733                     result.AddRange(info.GetFiles()); 
    734                 else 
    735                     result.AddRange(info.GetFiles(IncludeMask, SearchOption.TopDirectoryOnly)); 
     724 
     725                    if (IncludeMask.Length == 0) 
     726                        result.AddRange(info.GetFiles()); 
     727                    else 
     728                        result.AddRange(info.GetFiles(IncludeMask, SearchOption.TopDirectoryOnly)); 
     729                } 
     730                catch (UnauthorizedAccessException e) 
     731                { 
     732                    Task.Log.LastSessionEntries.Add(new LogEntry(S._("Could not erase files and " + 
     733                        "subfolders in {0} because {1}", info.FullName, e.Message), LogLevel.Error)); 
     734                } 
    736735            } 
    737736 
Note: See TracChangeset for help on using the changeset viewer.