summaryrefslogtreecommitdiff
path: root/src/SMAPI.Installer/InteractiveInstaller.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-12-05 19:10:39 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-12-05 19:10:39 -0500
commit8a2618d812e4e2f36161907af5af5c484eb37abf (patch)
treec164325cf57fb43e4375e94dc584fbc3ab3ceeb5 /src/SMAPI.Installer/InteractiveInstaller.cs
parent42e878e77d58569be81e34ca206a78e0ebe0604d (diff)
parent5b5dd47c22a1332a4c432d6a1cd414b5c83388d7 (diff)
downloadSMAPI-8a2618d812e4e2f36161907af5af5c484eb37abf.tar.gz
SMAPI-8a2618d812e4e2f36161907af5af5c484eb37abf.tar.bz2
SMAPI-8a2618d812e4e2f36161907af5af5c484eb37abf.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Installer/InteractiveInstaller.cs')
-rw-r--r--src/SMAPI.Installer/InteractiveInstaller.cs63
1 files changed, 51 insertions, 12 deletions
diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs
index d8c27a2d..1257f12b 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 modern 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,15 +724,32 @@ namespace StardewModdingApi.Installer
this.PrintWarning("That directory doesn't seem to exist.");
continue;
}
- if (!context.LooksLikeGameFolder(directory))
+
+ switch (context.GetGameFolderType(directory))
{
- this.PrintWarning("That directory doesn't contain a Stardew Valley executable.");
- continue;
- }
+ 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.");
+ continue;
- // looks OK
- this.PrintInfo(" OK!");
- return directory;
+ 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 modern 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;
+
+ default:
+ this.PrintWarning("That directory doesn't seem to contain a valid game install.");
+ continue;
+ }
}
}