доработано обновление
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
8
Updater/Properties/launchSettings.json
Normal file
8
Updater/Properties/launchSettings.json
Normal 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\""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user