mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[FileTools] Create and use safe file/directory delete
This commit is contained in:
@@ -149,16 +149,9 @@ namespace SabreTools.Helper.Dats
|
||||
|
||||
// Now that we're done, delete the temp folder (if it's not the default)
|
||||
Globals.Logger.User("Cleaning temp folder");
|
||||
try
|
||||
if (tempDir != Path.GetTempPath())
|
||||
{
|
||||
if (tempDir != Path.GetTempPath())
|
||||
{
|
||||
Directory.Delete(tempDir, true);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Just absorb the error for now
|
||||
FileTools.SafeTryDeleteDirectory(tempDir);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -333,18 +326,11 @@ namespace SabreTools.Helper.Dats
|
||||
// Cue to delete the file if it's a copy
|
||||
if (copyFiles && item != newItem)
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.Delete(newBasePath, true);
|
||||
}
|
||||
catch { }
|
||||
FileTools.SafeTryDeleteDirectory(newBasePath);
|
||||
}
|
||||
|
||||
// Delete the sub temp directory
|
||||
if (Directory.Exists(tempSubDir))
|
||||
{
|
||||
Directory.Delete(tempSubDir, true);
|
||||
}
|
||||
FileTools.SafeTryDeleteDirectory(tempSubDir);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user