Browse Source

added white spaces check in game path, fix updater start

Veloe 2 years ago
parent
commit
c72e06f9f5

+ 10 - 1
VeloeMinecraftLauncher/ViewModels/MainWindowViewModel.cs

@@ -185,6 +185,15 @@ public class MainWindowViewModel : ViewModelBase
                 OpenErrorWindow(ex);
             }
             try
+            {
+                if (Settings.minecraftForlderPath.Contains(' '))
+                    OpenErrorWindow("The game folder contains spaces, it can break internal java versions. Please change the game folder in settings.");
+            }
+            catch (Exception ex)
+            {
+                OpenErrorWindow(ex);
+            }
+            try
             {
                 _logger.Debug("Checking modpacks updates...");
                 var modpacksInfo = Downloader.DownloadAndDeserializeJsonData<List<Modpack>>("https://files.veloe.link/launcher/modpacks.json");
@@ -726,7 +735,7 @@ public class MainWindowViewModel : ViewModelBase
         if (!File.Exists(updater.StartInfo.FileName))
             UpdateUpdater();
 
-        if (!File.Exists(updater.StartInfo.FileName))
+        if (File.Exists(updater.StartInfo.FileName))
         {
             updater.Start();
 

+ 5 - 0
VeloeMinecraftLauncher/ViewModels/SettingsWindowViewModel.cs

@@ -24,6 +24,11 @@ public class SettingsWindowViewModel : ViewModelBase
         value => { UInt32 result; bool resultb = UInt32.TryParse(value, out result); /*logger.Debug("Validator result: {0} {1}", value, resultb);*/ IsValid = resultb; return resultb; },
         "Not a number.");
 
+        this.ValidationRule(
+        viewModel => viewModel.MinecraftFolderPath,
+        value => { bool resultb = !value?.Contains(' ') ?? false; IsValid = resultb; return resultb; },
+        "Path contains spaces, it can break internal java intallation.");
+
         this.ValidationRule(
         viewModel => viewModel.MaxLog,
         value => { UInt32 result; bool resultb = UInt32.TryParse(value, out result); /*logger.Debug("Validator result: {0} {1}", value, resultb);*/ IsValid = resultb; return resultb; },