From 871bf2f9b1d3b36cb0772575661d712423aa32d3 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sat, 5 Aug 2023 00:22:29 +0100 Subject: [PATCH] Prompt to validate install location correction --- Bloxstrap/InstallChecker.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Bloxstrap/InstallChecker.cs b/Bloxstrap/InstallChecker.cs index 75219bf..a833acb 100644 --- a/Bloxstrap/InstallChecker.cs +++ b/Bloxstrap/InstallChecker.cs @@ -1,5 +1,4 @@ using System.Windows; - using Microsoft.Win32; namespace Bloxstrap @@ -29,9 +28,23 @@ namespace Bloxstrap return; } + App.Logger.WriteLine(LOG_IDENT, "Installation registry key is likely malformed"); + _installLocation = Path.GetDirectoryName(Paths.Process)!; - App.Logger.WriteLine(LOG_IDENT, $"Registry key is likely malformed. Setting install location as '{_installLocation}'"); + var result = Controls.ShowMessageBox( + $"It appears as if {App.ProjectName} hasn't been properly installed. Is it supposed to be installed at {_installLocation}?", + MessageBoxImage.Warning, + MessageBoxButton.YesNo + ); + + if (result != MessageBoxResult.Yes) + { + FirstTimeRun(); + return; + } + + App.Logger.WriteLine(LOG_IDENT, $"Setting install location as '{_installLocation}'"); if (_registryKey is null) _registryKey = Registry.CurrentUser.CreateSubKey($"Software\\{App.ProjectName}");