From cb9d6ae5ad9252c2a36174856b28f12344d026f3 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 4 Dec 2021 23:47:27 -0500 Subject: improve error when installer is pointed at a SDV 1.5.4 folder --- src/SMAPI.Installer/InteractiveInstaller.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/SMAPI.Installer/InteractiveInstaller.cs') diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index d8c27a2d..424fe42b 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -704,7 +704,15 @@ namespace StardewModdingApi.Installer } if (!context.LooksLikeGameFolder(directory)) { - this.PrintWarning("That directory doesn't contain a Stardew Valley executable."); + if (context.LooksLikeStardewValley154(directory)) + { + this.PrintWarning("That directory seems to have Stardew Valley 1.5.4 or earlier."); + this.PrintWarning("Please update your game to the latest version to use SMAPI."); + } + else + { + this.PrintWarning("That directory doesn't contain a Stardew Valley executable."); + } continue; } -- cgit From 98d01d522d488192b5d5da50d70752a8c0739a94 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 5 Dec 2021 00:51:24 -0500 Subject: improve error when installer is pointed at a compatibility-branch game folder --- src/SMAPI.Installer/InteractiveInstaller.cs | 65 +++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 17 deletions(-) (limited to 'src/SMAPI.Installer/InteractiveInstaller.cs') diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index 424fe42b..6694c257 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -10,6 +10,7 @@ using StardewModdingAPI.Installer.Framework; using StardewModdingAPI.Internal.ConsoleWriting; using StardewModdingAPI.Toolkit; using StardewModdingAPI.Toolkit.Framework; +using StardewModdingAPI.Toolkit.Framework.GameScanning; using StardewModdingAPI.Toolkit.Framework.ModScanning; using StardewModdingAPI.Toolkit.Utilities; @@ -633,18 +634,39 @@ namespace StardewModdingApi.Installer // use specified path if (specifiedPath != null) { + string errorPrefix = $"You specified --game-path \"{specifiedPath}\", but"; + var dir = new DirectoryInfo(specifiedPath); if (!dir.Exists) { - this.PrintError($"You specified --game-path \"{specifiedPath}\", but that folder doesn't exist."); + this.PrintError($"{errorPrefix} that folder doesn't exist."); return null; } - if (!context.LooksLikeGameFolder(dir)) + + switch (context.GetGameFolderType(dir)) { - this.PrintError($"You specified --game-path \"{specifiedPath}\", but that folder doesn't contain the Stardew Valley executable."); - return null; + case GameFolderType.Valid: + return dir; + + case GameFolderType.Legacy154OrEarlier: + this.PrintWarning($"{errorPrefix} that directory seems to have Stardew Valley 1.5.4 or earlier."); + this.PrintWarning("Please update your game to the latest version to use SMAPI."); + return null; + + case GameFolderType.LegacyCompatibilityBranch: + this.PrintWarning($"{errorPrefix} that directory seems to have the Stardew Valley legacy 'compatibility' branch."); + this.PrintWarning("Unfortunately SMAPI is only compatible with the full main version of the game."); + this.PrintWarning("Please update your game to the main branch to use SMAPI."); + return null; + + case GameFolderType.NoGameFound: + this.PrintWarning($"{errorPrefix} that directory doesn't contain a Stardew Valley executable."); + return null; + + default: + this.PrintWarning($"{errorPrefix} that directory doesn't seem to contain a valid game install."); + return null; } - return dir; } // let user choose detected path @@ -702,23 +724,32 @@ namespace StardewModdingApi.Installer this.PrintWarning("That directory doesn't seem to exist."); continue; } - if (!context.LooksLikeGameFolder(directory)) + + switch (context.GetGameFolderType(directory)) { - if (context.LooksLikeStardewValley154(directory)) - { + case GameFolderType.Valid: + this.PrintInfo(" OK!"); + return directory; + + case GameFolderType.Legacy154OrEarlier: this.PrintWarning("That directory seems to have Stardew Valley 1.5.4 or earlier."); this.PrintWarning("Please update your game to the latest version to use SMAPI."); - } - else - { + continue; + + case GameFolderType.LegacyCompatibilityBranch: + this.PrintWarning("That directory seems to have the Stardew Valley legacy 'compatibility' branch."); + this.PrintWarning("Unfortunately SMAPI is only compatible with the full main version of the game."); + this.PrintWarning("Please update your game to the main branch to use SMAPI."); + continue; + + case GameFolderType.NoGameFound: this.PrintWarning("That directory doesn't contain a Stardew Valley executable."); - } - continue; - } + continue; - // looks OK - this.PrintInfo(" OK!"); - return directory; + default: + this.PrintWarning("That directory doesn't seem to contain a valid game install."); + continue; + } } } -- cgit From 5b5dd47c22a1332a4c432d6a1cd414b5c83388d7 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 5 Dec 2021 19:10:28 -0500 Subject: prepare for release --- src/SMAPI.Installer/InteractiveInstaller.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/SMAPI.Installer/InteractiveInstaller.cs') diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index 6694c257..1257f12b 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -655,7 +655,7 @@ namespace StardewModdingApi.Installer case GameFolderType.LegacyCompatibilityBranch: this.PrintWarning($"{errorPrefix} that directory seems to have the Stardew Valley legacy 'compatibility' branch."); - this.PrintWarning("Unfortunately SMAPI is only compatible with the full main version of the game."); + this.PrintWarning("Unfortunately SMAPI is only compatible with the modern version of the game."); this.PrintWarning("Please update your game to the main branch to use SMAPI."); return null; @@ -738,7 +738,7 @@ namespace StardewModdingApi.Installer case GameFolderType.LegacyCompatibilityBranch: this.PrintWarning("That directory seems to have the Stardew Valley legacy 'compatibility' branch."); - this.PrintWarning("Unfortunately SMAPI is only compatible with the full main version of the game."); + this.PrintWarning("Unfortunately SMAPI is only compatible with the modern version of the game."); this.PrintWarning("Please update your game to the main branch to use SMAPI."); continue; -- cgit