only delete file when downloaded from http

This commit is contained in:
Pascal Schedel
2024-12-04 14:56:41 +01:00
parent 3023990a55
commit 5663f5ee5d
2 changed files with 2 additions and 3 deletions

View File

@@ -200,7 +200,7 @@ public class UpdateClient(string updateUrl, AppVersion currentVersion, AppChanne
File.Delete(packagePath); File.Delete(packagePath);
Directory.Delete(dataPath, true); Directory.Delete(dataPath, true);
} }
else if (package.PackageType == PackageType.File) else if (package.PackageType == PackageType.File && package.AddressType == PackageAddressType.Http)
File.Delete(dataPath); File.Delete(dataPath);
RaiseStatusChanged(UpdateStatus.Cleanup, UpdateStatusEvent.PostEvent); RaiseStatusChanged(UpdateStatus.Cleanup, UpdateStatusEvent.PostEvent);

View File

@@ -42,7 +42,7 @@ public static class Utils
oldFile = destFileName + ".old"; oldFile = destFileName + ".old";
File.Move(destFileName, oldFile, true); File.Move(destFileName, oldFile, true);
triesLeft++; triesLeft++;
Thread.Sleep(1000); Thread.Sleep(100);
} }
} }
catch (Exception) catch (Exception)
@@ -55,7 +55,6 @@ public static class Utils
try try
{ {
File.Delete(oldFile); File.Delete(oldFile);
Thread.Sleep(1000);
} }
catch (Exception) catch (Exception)
{ {