From 307bf6ce55e8880f0e0382cb678d7fcc6c74c11e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 19 Aug 2018 21:08:58 -0400 Subject: adjust SaveBackup mod to simplify installer logic (#583) --- src/SMAPI.Installer/InteractiveInstaller.cs | 30 ++--------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'src/SMAPI.Installer/InteractiveInstaller.cs') diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index f9e1ff94..a92edadf 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -22,12 +22,6 @@ namespace StardewModdingApi.Installer /// The name of the installer file in the package. private readonly string InstallerFileName = "install.exe"; - /// Mod files which shouldn't be deleted when deploying bundled mods (mod folder name => file names). - private readonly IDictionary> ProtectBundledFiles = new Dictionary>(StringComparer.InvariantCultureIgnoreCase) - { - ["SaveBackup"] = new HashSet(new[] { "backups", "config.json" }, StringComparer.InvariantCultureIgnoreCase) - }; - /// The value that represents Windows 7. private readonly Version Windows7Version = new Version(6, 1); @@ -474,18 +468,6 @@ namespace StardewModdingApi.Installer { this.PrintDebug("Adding bundled mods..."); - // special case: rename Omegasis' SaveBackup mod - { - DirectoryInfo oldFolder = new DirectoryInfo(Path.Combine(paths.ModsDir.FullName, "SaveBackup")); - DirectoryInfo newFolder = new DirectoryInfo(Path.Combine(paths.ModsDir.FullName, "AdvancedSaveBackup")); - FileInfo manifest = new FileInfo(Path.Combine(oldFolder.FullName, "manifest.json")); - if (manifest.Exists && !newFolder.Exists && File.ReadLines(manifest.FullName).Any(p => p.IndexOf("Omegasis", StringComparison.InvariantCultureIgnoreCase) != -1)) - { - this.PrintDebug($" moving {oldFolder.Name} to {newFolder.Name}..."); - this.Move(oldFolder, newFolder.FullName); - } - } - // add bundled mods foreach (DirectoryInfo sourceDir in packagedModsDir.EnumerateDirectories()) { @@ -494,16 +476,8 @@ namespace StardewModdingApi.Installer // init/clear target dir DirectoryInfo targetDir = new DirectoryInfo(Path.Combine(paths.ModsDir.FullName, sourceDir.Name)); if (targetDir.Exists) - { - this.ProtectBundledFiles.TryGetValue(targetDir.Name, out HashSet protectedFiles); - foreach (FileSystemInfo entry in targetDir.EnumerateFileSystemInfos()) - { - if (protectedFiles == null || !protectedFiles.Contains(entry.Name)) - this.InteractivelyDelete(entry.FullName); - } - } - else - targetDir.Create(); + this.InteractivelyDelete(targetDir.FullName); + targetDir.Create(); // copy files foreach (FileInfo sourceFile in sourceDir.EnumerateFiles().Where(this.ShouldCopy)) -- cgit