diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-05-03 18:11:31 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-05-03 18:11:31 -0400 |
commit | 5d3d919d490fd414fe9647e566e92c71d7f64509 (patch) | |
tree | e1eab3352287ef04b5de4cdc28b550e255d58c3f /src/SMAPI.Toolkit/Framework | |
parent | c48f6d78cc412c5f2e40a8b460b7b3c1c993c51a (diff) | |
parent | 3447e2f575c2c83af729777e4d37e93f4c2a6467 (diff) | |
download | SMAPI-5d3d919d490fd414fe9647e566e92c71d7f64509.tar.gz SMAPI-5d3d919d490fd414fe9647e566e92c71d7f64509.tar.bz2 SMAPI-5d3d919d490fd414fe9647e566e92c71d7f64509.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Toolkit/Framework')
5 files changed, 16 insertions, 14 deletions
diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs index 2fb6ed20..c2d906a0 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs @@ -61,7 +61,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi /// <param name="content">The body content to post.</param> private TResult Post<TBody, TResult>(string url, TBody content) { - // note: avoid HttpClient for Mac compatibility + // note: avoid HttpClient for macOS compatibility using WebClient client = new WebClient(); Uri fullUrl = new Uri(this.BaseUrl, url); diff --git a/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs b/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs index 785daba3..c90fc1d3 100644 --- a/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs +++ b/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs @@ -20,9 +20,6 @@ namespace StardewModdingAPI.Toolkit.Framework.GameScanning /// <summary>The current OS.</summary> private readonly Platform Platform; - /// <summary>The name of the Stardew Valley executable.</summary> - private readonly string ExecutableName; - /********* ** Public methods @@ -31,7 +28,6 @@ namespace StardewModdingAPI.Toolkit.Framework.GameScanning public GameScanner() { this.Platform = EnvironmentUtility.DetectPlatform(); - this.ExecutableName = EnvironmentUtility.GetExecutableName(this.Platform); } /// <summary>Find all valid Stardew Valley install folders.</summary> @@ -58,7 +54,12 @@ namespace StardewModdingAPI.Toolkit.Framework.GameScanning /// <param name="dir">The folder to check.</param> public bool LooksLikeGameFolder(DirectoryInfo dir) { - return dir.Exists && dir.EnumerateFiles(this.ExecutableName).Any(); + return + dir.Exists + && ( + dir.EnumerateFiles("StardewValley.exe").Any() + || dir.EnumerateFiles("Stardew Valley.exe").Any() + ); } @@ -82,7 +83,7 @@ namespace StardewModdingAPI.Toolkit.Framework.GameScanning ? $"{home}/.steam/steam/steamapps/common/Stardew Valley" : $"{home}/.local/share/Steam/steamapps/common/Stardew Valley"; - // Mac + // macOS yield return "/Applications/Stardew Valley.app/Contents/MacOS"; yield return $"{home}/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS"; } diff --git a/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs b/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs index e635725c..8cbd8e51 100644 --- a/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs +++ b/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs @@ -74,7 +74,7 @@ namespace StardewModdingAPI.Toolkit.Framework break; case nameof(Platform.Mac): - name = $"MacOS {name}"; + name = $"macOS {name}"; break; } return name; @@ -124,10 +124,10 @@ namespace StardewModdingAPI.Toolkit.Framework } } - /// <summary>Detect whether the code is running on Mac.</summary> + /// <summary>Detect whether the code is running on macOS.</summary> /// <remarks> - /// This code is derived from the Mono project (see System.Windows.Forms/System.Windows.Forms/XplatUI.cs). It detects Mac by calling the - /// <c>uname</c> system command and checking the response, which is always 'Darwin' for MacOS. + /// This code is derived from the Mono project (see System.Windows.Forms/System.Windows.Forms/XplatUI.cs). It detects macOS by calling the + /// <c>uname</c> system command and checking the response, which is always 'Darwin' for macOS. /// </remarks> private static bool IsRunningMac() { diff --git a/src/SMAPI.Toolkit/Framework/ModData/ModWarning.cs b/src/SMAPI.Toolkit/Framework/ModData/ModWarning.cs index 925e0b5c..afebba87 100644 --- a/src/SMAPI.Toolkit/Framework/ModData/ModWarning.cs +++ b/src/SMAPI.Toolkit/Framework/ModData/ModWarning.cs @@ -18,7 +18,7 @@ namespace StardewModdingAPI.Toolkit.Framework.ModData /// <summary>The mod patches the game in a way that may impact stability.</summary> PatchesGame = 4, - /// <summary>The mod uses the <c>dynamic</c> keyword which won't work on Linux/Mac.</summary> + /// <summary>The mod uses the <c>dynamic</c> keyword which won't work on Linux/macOS.</summary> UsesDynamic = 8, /// <summary>The mod references specialized 'unvalidated update tick' events which may impact stability.</summary> diff --git a/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs b/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs index fd206d9d..e6105f9c 100644 --- a/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs +++ b/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs @@ -21,7 +21,7 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning private readonly HashSet<Regex> IgnoreFilesystemNames = new HashSet<Regex> { new Regex(@"^__folder_managed_by_vortex$", RegexOptions.Compiled | RegexOptions.IgnoreCase), // Vortex mod manager - new Regex(@"(?:^\._|^\.DS_Store$|^__MACOSX$|^mcs$)", RegexOptions.Compiled | RegexOptions.IgnoreCase), // MacOS + new Regex(@"(?:^\._|^\.DS_Store$|^__MACOSX$|^mcs$)", RegexOptions.Compiled | RegexOptions.IgnoreCase), // macOS new Regex(@"^(?:desktop\.ini|Thumbs\.db)$", RegexOptions.Compiled | RegexOptions.IgnoreCase) // Windows }; @@ -38,6 +38,7 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning // images ".bmp", ".gif", + ".ico", ".jpeg", ".jpg", ".png", @@ -136,7 +137,7 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning return new ModFolder(root, searchFolder, ModType.Xnb, null, ModParseError.XnbMod, "it's not a SMAPI mod (see https://smapi.io/xnb for info)."); // SMAPI installer - if (relevantFiles.Any(p => p.Name == "install on Linux.sh" || p.Name == "install on Mac.command" || p.Name == "install on Windows.bat")) + if (relevantFiles.Any(p => p.Name == "install on Linux.sh" || p.Name == "install on macOS.command" || p.Name == "install on Windows.bat")) return new ModFolder(root, searchFolder, ModType.Invalid, null, ModParseError.ManifestMissing, "the SMAPI installer isn't a mod (you can delete this folder after running the installer file)."); // not a mod? |