summaryrefslogtreecommitdiff
path: root/src/SMAPI.Installer
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-05-20 19:38:08 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-05-20 19:38:08 -0400
commit310eb1fe9afdb820d5584a46200bf073fc00ccb7 (patch)
tree72c16c6d4f8447f45e8e6612cb25cd255d2b308c /src/SMAPI.Installer
parentaa5cc2c9be8bdc79c6fa7b1b9c2581a05b88117d (diff)
parentc5c30189e43f93c3f3c66207945187a974656c9e (diff)
downloadSMAPI-310eb1fe9afdb820d5584a46200bf073fc00ccb7.tar.gz
SMAPI-310eb1fe9afdb820d5584a46200bf073fc00ccb7.tar.bz2
SMAPI-310eb1fe9afdb820d5584a46200bf073fc00ccb7.zip
Merge branch 'mod/harmony-2.0' into develop
# Conflicts: # docs/release-notes.md # src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
Diffstat (limited to 'src/SMAPI.Installer')
-rw-r--r--src/SMAPI.Installer/InteractiveInstaller.cs38
1 files changed, 1 insertions, 37 deletions
diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs
index f8371d57..1457848b 100644
--- a/src/SMAPI.Installer/InteractiveInstaller.cs
+++ b/src/SMAPI.Installer/InteractiveInstaller.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
-using System.Threading;
using Microsoft.Win32;
using StardewModdingApi.Installer.Enums;
using StardewModdingAPI.Installer.Framework;
@@ -624,7 +623,7 @@ namespace StardewModdingApi.Installer
{
try
{
- this.ForceDelete(Directory.Exists(path) ? new DirectoryInfo(path) : (FileSystemInfo)new FileInfo(path));
+ FileUtilities.ForceDelete(Directory.Exists(path) ? new DirectoryInfo(path) : (FileSystemInfo)new FileInfo(path));
break;
}
catch (Exception ex)
@@ -665,41 +664,6 @@ namespace StardewModdingApi.Installer
}
}
- /// <summary>Delete a file or folder regardless of file permissions, and block until deletion completes.</summary>
- /// <param name="entry">The file or folder to reset.</param>
- /// <remarks>This method is mirrored from <c>FileUtilities.ForceDelete</c> in the toolkit.</remarks>
- private void ForceDelete(FileSystemInfo entry)
- {
- // ignore if already deleted
- entry.Refresh();
- if (!entry.Exists)
- return;
-
- // delete children
- if (entry is DirectoryInfo folder)
- {
- foreach (FileSystemInfo child in folder.GetFileSystemInfos())
- this.ForceDelete(child);
- }
-
- // reset permissions & delete
- entry.Attributes = FileAttributes.Normal;
- entry.Delete();
-
- // wait for deletion to finish
- for (int i = 0; i < 10; i++)
- {
- entry.Refresh();
- if (entry.Exists)
- Thread.Sleep(500);
- }
-
- // throw exception if deletion didn't happen before timeout
- entry.Refresh();
- if (entry.Exists)
- throw new IOException($"Timed out trying to delete {entry.FullName}");
- }
-
/// <summary>Interactively ask the user to choose a value.</summary>
/// <param name="print">A callback which prints a message to the console.</param>
/// <param name="message">The message to print.</param>