Skip to content

Commit

Permalink
Merge pull request #36 from SpeedrunTooling/DevBranch
Browse files Browse the repository at this point in the history
Fix a flaw in the newer 1.0.0.8 update logic that would cause a Direc…
  • Loading branch information
Squirrelies authored Aug 1, 2021
2 parents b60b53e + e3fd535 commit 35a5b11
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions SRTPluginManager/Core/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,19 @@ public static void UnzipPackage(string pluginName, string file, string destinati

if (!isSRT)
{
// Save plugin config file.
FileInfo configFile = new DirectoryInfo(Path.Combine(destination, pluginName)).EnumerateFiles(string.Format("{0}.cfg", pluginName), SearchOption.TopDirectoryOnly).FirstOrDefault();
DirectoryInfo pluginDirectory = new DirectoryInfo(Path.Combine(destination, pluginName));
if (pluginDirectory.Exists)
{
// Save plugin config file.
FileInfo configFile = pluginDirectory.EnumerateFiles(string.Format("{0}.cfg", pluginName), SearchOption.TopDirectoryOnly).FirstOrDefault();

// If the config file exists, copy it to the temp folder until after the delete and unzip completes.
if (configFile != default && configFile.Exists)
configFile.CopyTo(Path.Combine(TempFolderPath, configFile.Name), true);
// If the config file exists, copy it to the temp folder until after the delete and unzip completes.
if (configFile != default && configFile.Exists)
configFile.CopyTo(Path.Combine(TempFolderPath, configFile.Name), true);

// Delete the plugin folder to ensure a clean slate.
Directory.Delete(Path.Combine(destination, pluginName), true);
// Delete the plugin folder to ensure a clean slate.
pluginDirectory.Delete(true);
}
}

ZipFile.ExtractToDirectory(file, destination, true);
Expand Down

0 comments on commit 35a5b11

Please sign in to comment.