mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
* Closes #3156 * Misc * Misc * Rewrite update mechanism ONCE AGAIN, this time to eradicate FSW * Make creating debug directory non-fatal again, like it used to be * Deduplicate code * Remove dead code * Print update cleanup just once * Address remaining feedback, go back to _old and _new * One more nice improvement
This commit is contained in:
committed by
GitHub
parent
edc7c38ba0
commit
ae9dfca3b3
@@ -766,9 +766,31 @@ public static class PluginsCore {
|
||||
|
||||
try {
|
||||
foreach (string assemblyPath in Directory.EnumerateFiles(path, "*.dll", SearchOption.AllDirectories)) {
|
||||
string? assemblyDirectoryName = Path.GetFileName(Path.GetDirectoryName(assemblyPath));
|
||||
string? assemblyDirectory = Path.GetDirectoryName(assemblyPath);
|
||||
|
||||
if (assemblyDirectoryName == SharedInfo.UpdateDirectory) {
|
||||
if (string.IsNullOrEmpty(assemblyDirectory)) {
|
||||
throw new InvalidOperationException(nameof(assemblyDirectory));
|
||||
}
|
||||
|
||||
// Skip from loading those files that come from update directories
|
||||
// We determine that by checking if any directory name along the path to the assembly matches
|
||||
bool skip = false;
|
||||
|
||||
string? relativeAssemblyDirectory = Path.GetRelativePath(path, assemblyDirectory);
|
||||
string? relativeAssemblyDirectoryName = Path.GetFileName(relativeAssemblyDirectory);
|
||||
|
||||
while (!string.IsNullOrEmpty(relativeAssemblyDirectoryName)) {
|
||||
if (relativeAssemblyDirectoryName is SharedInfo.UpdateDirectoryOld or SharedInfo.UpdateDirectoryNew) {
|
||||
skip = true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
relativeAssemblyDirectory = Path.GetDirectoryName(relativeAssemblyDirectory);
|
||||
relativeAssemblyDirectoryName = Path.GetFileName(relativeAssemblyDirectory);
|
||||
}
|
||||
|
||||
if (skip) {
|
||||
ASF.ArchiLogger.LogGenericTrace(string.Format(CultureInfo.CurrentCulture, Strings.WarningSkipping, assemblyPath));
|
||||
|
||||
continue;
|
||||
@@ -822,12 +844,9 @@ public static class PluginsCore {
|
||||
throw new InvalidOperationException(nameof(assemblyDirectory));
|
||||
}
|
||||
|
||||
string backupDirectory = Path.Combine(assemblyDirectory, SharedInfo.UpdateDirectory);
|
||||
|
||||
if (Directory.Exists(backupDirectory)) {
|
||||
ASF.ArchiLogger.LogGenericInfo(Strings.UpdateCleanup);
|
||||
|
||||
Directory.Delete(backupDirectory, true);
|
||||
// If directories from previous update exist, it's a good idea to purge them now
|
||||
if (!await Utilities.UpdateCleanup(assemblyDirectory).ConfigureAwait(false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Uri? releaseURL = await plugin.GetTargetReleaseURL(asfVersion, SharedInfo.BuildInfo.Variant, asfUpdate, updateChannel, forced).ConfigureAwait(false);
|
||||
@@ -871,7 +890,7 @@ public static class PluginsCore {
|
||||
|
||||
await plugin.OnPluginUpdateProceeding().ConfigureAwait(false);
|
||||
|
||||
if (!Utilities.UpdateFromArchive(zipArchive, assemblyDirectory)) {
|
||||
if (!await Utilities.UpdateFromArchive(zipArchive, assemblyDirectory).ConfigureAwait(false)) {
|
||||
ASF.ArchiLogger.LogGenericError(Strings.WarningFailed);
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user