diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-03-07 18:04:48 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-03-07 18:04:48 -0500 |
commit | 0ed46c09104b823a5784690fa50e7022efc12c8f (patch) | |
tree | 6e2259d828b761449b27b4c9df85e7bdaea401f9 /src/SMAPI.Installer | |
parent | 36cb8e8fcb8afd2965ffe26e7755eb11838264d7 (diff) | |
download | SMAPI-0ed46c09104b823a5784690fa50e7022efc12c8f.tar.gz SMAPI-0ed46c09104b823a5784690fa50e7022efc12c8f.tar.bz2 SMAPI-0ed46c09104b823a5784690fa50e7022efc12c8f.zip |
add descriptive error for PathTooLongException which crashes SMAPI or the installer
Diffstat (limited to 'src/SMAPI.Installer')
-rw-r--r-- | src/SMAPI.Installer/InteractiveInstaller.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index ff74a659..3d673719 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -279,6 +279,7 @@ namespace StardewModdingApi.Installer /********* ** Step 4: validate assumptions *********/ + // executable exists if (!File.Exists(paths.ExecutablePath)) { this.PrintError("The detected game install path doesn't contain a Stardew Valley executable."); @@ -286,6 +287,17 @@ namespace StardewModdingApi.Installer return; } + // game folder doesn't contain paths beyond the max limit + { + string[] tooLongPaths = PathUtilities.GetTooLongPaths(Path.Combine(paths.GamePath, "Mods")).ToArray(); + if (tooLongPaths.Any()) + { + this.PrintError($"SMAPI can't install to the detected game folder, because some of its files exceed the maximum {context.Platform} path length.\nIf you need help fixing this error, see https://smapi.io/help\n\nAffected paths:\n {string.Join("\n ", tooLongPaths)}"); + Console.ReadLine(); + return; + } + } + /********* ** Step 5: ask what to do |