Changeset 2336


Ignore:
Timestamp:
10/30/11 01:02:03 (3 years ago)
Author:
lowjoel
Message:

Supplants r2335: Do not force a full re-erasure if the file cannot be deleted. At that stage, the file data is erased, if the file cannot be deleted, impact times will be impacted negatively. TryEraseStream? will only deal with stream data.

As such, when we have to run the unlocking code a second time, we should throw a Sharing Violation exception instead of silently swallowing the error.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser/Eraser.DefaultPlugins/ErasureTargets/FileSystemObjectErasureTarget.cs

    r2335 r2336  
    269269 
    270270                TryEraseStream(fsManager, method, info, callback); 
     271 
     272                //Remove the file. 
     273                FileInfo fileInfo = info.File; 
     274                if (fileInfo != null) 
     275                    fsManager.DeleteFile(fileInfo); 
    271276                progress.MarkComplete(); 
    272277            } 
     
    319324                        Logger.Log(S._("The file {0} is a hard link or a symbolic link thus the " + 
    320325                            "contents of the file was not erased.", LogLevel.Notice)); 
    321  
    322                     //Remove the file. 
    323                     FileInfo fileInfo = info.File; 
    324                     if (fileInfo != null) 
    325                         fsManager.DeleteFile(fileInfo); 
    326326                    return; 
    327327                } 
     
    357357                    } 
    358358 
    359                     if (processStr.Length != 0) 
    360                         Logger.Log(S._("Could not force closure of file \"{0}\" {1}", 
    361                                 info.FileName, S._("(locked by {0})", 
    362                                     processStr.ToString().Remove(processStr.Length - 2)).Trim()), 
    363                             LogLevel.Error); 
     359                    Logger.Log(S._("Could not force closure of file \"{0}\" {1}", 
     360                            info.FileName, S._("(locked by {0})", 
     361                                processStr.ToString().Remove(processStr.Length - 2)).Trim()), 
     362                        LogLevel.Error); 
     363                    throw; 
    364364                } 
    365365            } 
Note: See TracChangeset for help on using the changeset viewer.