Changeset 2641
- Timestamp:
- 5/22/2012 8:50:08 AM (12 months ago)
- Location:
- trunk/eraser/Eraser.DefaultPlugins
- Files:
-
- 2 edited
-
ErasureTargets/FileSystemObjectErasureTarget.cs (modified) (2 diffs)
-
FileSystems/Windows.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser/Eraser.DefaultPlugins/ErasureTargets/FileSystemObjectErasureTarget.cs
r2638 r2641 377 377 //Either we could not close all instances, or we already tried twice. Report 378 378 //the error. 379 StringBuilder processStr = new StringBuilder(); 380 foreach (OpenHandle handle in remainingHandles) 379 string processes = string.Empty; 381 380 { 382 try 381 StringBuilder processStr = new StringBuilder(); 382 foreach (OpenHandle handle in remainingHandles) 383 383 { 384 processStr.AppendFormat( 385 System.Globalization.CultureInfo.InvariantCulture, 386 "{0}, ", handle.Process.MainModule.FileName); 384 try 385 { 386 processStr.AppendFormat( 387 System.Globalization.CultureInfo.InvariantCulture, 388 "{0}, ", handle.Process.MainModule.FileName); 389 } 390 catch (System.ComponentModel.Win32Exception) 391 { 392 processStr.AppendFormat( 393 System.Globalization.CultureInfo.InvariantCulture, 394 "Process ID {0}, ", handle.Process.Id); 395 } 387 396 } 388 catch (System.ComponentModel.Win32Exception) 397 398 if (processStr.Length > 2) 389 399 { 390 processStr.AppendFormat( 391 System.Globalization.CultureInfo.InvariantCulture, 392 "Process ID {0}, ", handle.Process.Id); 400 processes = processStr.ToString().Remove(processStr.Length - 2)).Trim()); 401 } 402 else 403 { 404 processes = S._("(unknown)"); 393 405 } 394 406 } … … 396 408 throw new SharingViolationException(S._( 397 409 "Could not force closure of file \"{0}\" {1}", info.FileName, 398 S._("(locked by {0})", 399 processStr.ToString().Remove(processStr.Length - 2)).Trim()), 400 info.FileName); 410 S._("(locked by {0})", processes, info.FileName))); 401 411 } 402 412 } -
trunk/eraser/Eraser.DefaultPlugins/FileSystems/Windows.cs
r2559 r2641 139 139 } 140 140 141 StringBuilder processStr = new StringBuilder(); 142 foreach (OpenHandle handle in OpenHandle.Close(info.FullName)) 141 //Either we could not close all instances, or we already tried twice. Report 142 //the error. 143 string processes = string.Empty; 143 144 { 144 try 145 StringBuilder processStr = new StringBuilder(); 146 foreach (OpenHandle handle in remainingHandles) 145 147 { 146 processStr.AppendFormat( 147 System.Globalization.CultureInfo.InvariantCulture, 148 "{0}, ", handle.Process.MainModule.FileName); 148 try 149 { 150 processStr.AppendFormat( 151 System.Globalization.CultureInfo.InvariantCulture, 152 "{0}, ", handle.Process.MainModule.FileName); 153 } 154 catch (System.ComponentModel.Win32Exception) 155 { 156 processStr.AppendFormat( 157 System.Globalization.CultureInfo.InvariantCulture, 158 "Process ID {0}, ", handle.Process.Id); 159 } 149 160 } 150 catch (System.ComponentModel.Win32Exception) 161 162 if (processStr.Length > 2) 151 163 { 152 processStr.AppendFormat( 153 System.Globalization.CultureInfo.InvariantCulture, 154 "Process ID {0}, ", handle.Process.Id); 164 processes = processStr.ToString().Remove(processStr.Length - 2)).Trim()); 165 } 166 else 167 { 168 processes = S._("(unknown)"); 155 169 } 156 170 } 157 171 158 if (processStr.Length != 0) 159 Logger.Log(S._("Could not force closure of file \"{0}\" {1}", 160 info.FullName, S._("(locked by {0})", 161 processStr.ToString().Remove(processStr.Length - 2)).Trim()), 162 LogLevel.Error); 172 throw new SharingViolationException(S._( 173 "Could not force closure of file \"{0}\" {1}", info.FileName, 174 S._("(locked by {0})", processes, info.FileName))); 163 175 } 164 176
Note: See TracChangeset
for help on using the changeset viewer.
