доработано обновление
Some checks failed
CI / build-test (push) Failing after 55s
Release / pack-and-publish (release) Failing after 33s

This commit is contained in:
FrigaT
2025-12-12 09:23:48 +03:00
parent 9365aa16cd
commit 72b0d60f3a
10 changed files with 103 additions and 94 deletions

View File

@@ -23,12 +23,13 @@ public sealed class SafeFileInstaller : IInstaller
var rel = Path.GetRelativePath(sourceDir, src);
var dst = Path.Combine(installPath, rel);
var dstDir = Path.GetDirectoryName(dst)!;
Directory.CreateDirectory(dstDir);
if (!Directory.Exists(dstDir)) Directory.CreateDirectory(dstDir);
if (File.Exists(dst))
{
var bkp = Path.Combine(backupDir, rel);
Directory.CreateDirectory(Path.GetDirectoryName(bkp)!);
var bkpDir = Path.GetDirectoryName(bkp);
if (!Directory.Exists(bkpDir)) Directory.CreateDirectory(bkpDir!);
File.Copy(dst, bkp, overwrite: true);
}
@@ -63,7 +64,8 @@ public sealed class SafeFileInstaller : IInstaller
{
var rel = Path.GetRelativePath(backupDir, bkp);
var dst = Path.Combine(installPath, rel);
Directory.CreateDirectory(Path.GetDirectoryName(dst)!);
var dstDir = Path.GetDirectoryName(dst);
if (!Directory.Exists(dstDir)) Directory.CreateDirectory(dstDir!);
File.Copy(bkp, dst, overwrite: true);
}
}

View File

@@ -12,6 +12,7 @@ public sealed class UpdaterApp
private readonly IInstaller _installer;
private readonly IProcessManager _proc;
/// <inheritdoc/>
public UpdaterApp(ILogger log, IExtractor extractor, IInstaller installer, IProcessManager proc)
{
_log = log;
@@ -34,6 +35,7 @@ public sealed class UpdaterApp
{
_log.Error($"Extraction failed: {ex.Message}");
Cleanup(tempExtractDir);
_proc.StartApp(opts.InstallPath, opts.AppExe, opts.RestartDelayMs);
return ExitCodes.ExtractFailed;
}
@@ -45,6 +47,7 @@ public sealed class UpdaterApp
{
_log.Error($"Install failed: {ex.Message}");
Cleanup(tempExtractDir);
_proc.StartApp(opts.InstallPath, opts.AppExe, opts.RestartDelayMs);
return ExitCodes.InstallFailed;
}

View File

@@ -0,0 +1,8 @@
{
"profiles": {
"Updater": {
"commandName": "Project",
"commandLineArgs": "-z \"C:\\Job\\Projects\\FrigaT\\ReleaseUpdater\\Updater.Test\\bin\\Debug\\net8.0\\Tools\\tempUpdater\\updater_32f606dc1cda473ab953206927bf047b.zip\" -i \"C:\\Job\\Projects\\FrigaT\\ReleaseUpdater\\Updater.Test\\bin\\Debug\\net8.0\" -a \"RetailUpdatesBot.exe\" -rd \"500\" -ud \"500\" -wp \"31408\""
}
}
}

View File

@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>1.0.0</Version>
<Version>2.0.0</Version>
<Authors>FrigaT</Authors>
<Company>FrigaT</Company>
<Product>ReleaseUpdater</Product>