From 09d20ac42771f6bd227d61db0baebb94ad954bdb Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Mon, 26 Jun 2023 21:50:47 +0100 Subject: [PATCH] Add installation path check (#314) --- .../UI/Menu/ViewModels/InstallationViewModel.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Bloxstrap/UI/Menu/ViewModels/InstallationViewModel.cs b/Bloxstrap/UI/Menu/ViewModels/InstallationViewModel.cs index 0fd9fad..e3ca027 100644 --- a/Bloxstrap/UI/Menu/ViewModels/InstallationViewModel.cs +++ b/Bloxstrap/UI/Menu/ViewModels/InstallationViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; +using System.IO; using System.Linq; using System.Threading.Tasks; using System.Windows; @@ -65,11 +66,15 @@ namespace Bloxstrap.UI.Menu.ViewModels { using var dialog = new FolderBrowserDialog(); - if (dialog.ShowDialog() == DialogResult.OK) - { + if (dialog.ShowDialog() != DialogResult.OK) + return; + + if (!dialog.SelectedPath.EndsWith(App.ProjectName)) + InstallLocation = Path.Combine(dialog.SelectedPath, App.ProjectName); + else InstallLocation = dialog.SelectedPath; - OnPropertyChanged(nameof(InstallLocation)); - } + + OnPropertyChanged(nameof(InstallLocation)); } private void OpenFolder()