move live install check to precheck viewmodel

also deletes log file and doens't log anything at the message viewmodel so the log isn't in the live directory
This commit is contained in:
IsWaffle 2023-09-16 16:49:24 -04:00
parent 987f62ed5f
commit 85a562079c
4 changed files with 28 additions and 9 deletions

View File

@ -34,11 +34,6 @@ public class InitializationTask : InstallerTaskBase
return Result.FromError("Unable to find original EFT directory, please make sure EFT is installed. Please also run EFT once");
}
if (_data.OriginalGamePath == _data.TargetInstallPath)
{
return Result.FromError("Installer is located in EFT's original directory. Please move the installer to a seperate folder as per the guide");
}
if (File.Exists(Path.Join(_data.TargetInstallPath, "EscapeFromTarkov.exe")))
{
return Result.FromError("Installer is located in a folder that has existing game files. Please make sure the installer is in a fresh folder as per the guide");

View File

@ -9,8 +9,8 @@
<PackageIcon>icon.ico</PackageIcon>
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
<Configurations>Debug;Release;TEST</Configurations>
<AssemblyVersion>2.12</AssemblyVersion>
<FileVersion>2.12</FileVersion>
<AssemblyVersion>2.13</AssemblyVersion>
<FileVersion>2.13</FileVersion>
</PropertyGroup>
<ItemGroup>

View File

@ -54,7 +54,7 @@ public class MessageViewModel : ViewModelBase
}
});
public MessageViewModel(IScreen Host, IResult result, bool showCloseButton = true) : base(Host)
public MessageViewModel(IScreen Host, IResult result, bool showCloseButton = true, bool noLog = false) : base(Host)
{
ShowCloseButton = showCloseButton;
Message = result.Message;
@ -75,6 +75,8 @@ public class MessageViewModel : ViewModelBase
}
HasErrors = true;
if (!noLog)
Log.Error(Message);
}
}

View File

@ -2,6 +2,7 @@
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Input;
using Avalonia.Controls;
using Avalonia.Threading;
using DialogHostAvalonia;
using ReactiveUI;
@ -78,6 +79,7 @@ public class PreChecksViewModel : ViewModelBase
if (data.OriginalGamePath == null)
{
NavigateTo(new MessageViewModel(HostScreen, Result.FromError("Could not find EFT install.\n\nDo you own and have the game installed?")));
return;
}
#endif
@ -86,6 +88,26 @@ public class PreChecksViewModel : ViewModelBase
Log.Information($"Install Path: {FileHelper.GetRedactedPath(InstallPath)}");
if (data.OriginalGamePath == data.TargetInstallPath)
{
Log.CloseAndFlush();
var logFiles = Directory.GetFiles(InstallPath, "spt-aki-installer_*.log");
// remove log file from original game path if they exist
foreach (var file in logFiles)
{
try
{
File.Delete(file);
}
catch { }
}
NavigateTo(new MessageViewModel(HostScreen, Result.FromError("Installer is located in EFT's original directory. Please move the installer to a seperate folder as per the guide"), noLog: true));
return;
}
Task.Run(async () =>
{
if (FileHelper.CheckPathForProblemLocations(InstallPath))