summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/release-notes.md5
-rw-r--r--src/SMAPI/Framework/IModMetadata.cs3
-rw-r--r--src/SMAPI/Framework/ModLoading/ModMetadata.cs7
-rw-r--r--src/SMAPI/Framework/ModLoading/ModResolver.cs5
-rw-r--r--src/SMAPI/Framework/SCore.cs10
5 files changed, 20 insertions, 10 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index 63db5dc3..8b644a43 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -6,10 +6,7 @@
* You can now group mods into subfolders to organise them.
* Most SMAPI files are now tucked into a `smapi-internal` subfolder.
* Save backups are now in a `save-backups` subfolder, so they're easier to access. Note that previous backups will be deleted when you update.
- * Improved error messages when...
- * an XNB mod is added to `Mods`;
- * you install the wrong version of SMAPI for your OS;
- * SMAPI can't prepare its folders.
+ * Improved various error messages to be more clear and intuitive.
* Fixed transparency issues on Linux/Mac for some mod images.
* Fixed error when a mod manifest is corrupted.
* Fixed error when a mod adds an unnamed location.
diff --git a/src/SMAPI/Framework/IModMetadata.cs b/src/SMAPI/Framework/IModMetadata.cs
index 85d1b619..a62c9950 100644
--- a/src/SMAPI/Framework/IModMetadata.cs
+++ b/src/SMAPI/Framework/IModMetadata.cs
@@ -18,6 +18,9 @@ namespace StardewModdingAPI.Framework
/// <summary>The mod's full directory path.</summary>
string DirectoryPath { get; }
+ /// <summary>The <see cref="DirectoryPath"/> relative to the game's Mods folder.</summary>
+ string RelativeDirectoryPath { get; }
+
/// <summary>Metadata about the mod from SMAPI's internal data (if any).</summary>
ModDataRecordVersionedFields DataRecord { get; }
diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs
index c02f0830..0a5f5d3f 100644
--- a/src/SMAPI/Framework/ModLoading/ModMetadata.cs
+++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs
@@ -19,6 +19,9 @@ namespace StardewModdingAPI.Framework.ModLoading
/// <summary>The mod's full directory path.</summary>
public string DirectoryPath { get; }
+ /// <summary>The <see cref="IModMetadata.DirectoryPath"/> relative to the game's Mods folder.</summary>
+ public string RelativeDirectoryPath { get; }
+
/// <summary>The mod manifest.</summary>
public IManifest Manifest { get; }
@@ -59,12 +62,14 @@ namespace StardewModdingAPI.Framework.ModLoading
/// <summary>Construct an instance.</summary>
/// <param name="displayName">The mod's display name.</param>
/// <param name="directoryPath">The mod's full directory path.</param>
+ /// <param name="relativeDirectoryPath">The <paramref name="directoryPath"/> relative to the game's Mods folder.</param>
/// <param name="manifest">The mod manifest.</param>
/// <param name="dataRecord">Metadata about the mod from SMAPI's internal data (if any).</param>
- public ModMetadata(string displayName, string directoryPath, IManifest manifest, ModDataRecordVersionedFields dataRecord)
+ public ModMetadata(string displayName, string directoryPath, string relativeDirectoryPath, IManifest manifest, ModDataRecordVersionedFields dataRecord)
{
this.DisplayName = displayName;
this.DirectoryPath = directoryPath;
+ this.RelativeDirectoryPath = relativeDirectoryPath;
this.Manifest = manifest;
this.DataRecord = dataRecord;
}
diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs
index 65a311dc..26ec82d7 100644
--- a/src/SMAPI/Framework/ModLoading/ModResolver.cs
+++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs
@@ -41,7 +41,8 @@ namespace StardewModdingAPI.Framework.ModLoading
ModMetadataStatus status = folder.ManifestParseError == null
? ModMetadataStatus.Found
: ModMetadataStatus.Failed;
- yield return new ModMetadata(folder.DisplayName, folder.Directory.FullName, manifest, dataRecord).SetStatus(status, folder.ManifestParseError);
+ string relativePath = PathUtilities.GetRelativePath(rootPath, folder.Directory.FullName);
+ yield return new ModMetadata(folder.DisplayName, folder.Directory.FullName, relativePath, manifest, dataRecord).SetStatus(status, folder.ManifestParseError);
}
}
@@ -188,7 +189,7 @@ namespace StardewModdingAPI.Framework.ModLoading
{
if (mod.Status == ModMetadataStatus.Failed)
continue; // don't replace metadata error
- mod.SetStatus(ModMetadataStatus.Failed, $"its unique ID '{mod.Manifest.UniqueID}' is used by multiple mods ({string.Join(", ", group.Select(p => p.DisplayName))}).");
+ mod.SetStatus(ModMetadataStatus.Failed, $"you have multiple copies of this mod installed ({string.Join(", ", group.Select(p => p.RelativeDirectoryPath).OrderBy(p => p))}).");
}
}
}
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs
index 2c5cd2bd..af517379 100644
--- a/src/SMAPI/Framework/SCore.cs
+++ b/src/SMAPI/Framework/SCore.cs
@@ -908,7 +908,7 @@ namespace StardewModdingAPI.Framework
}
// validate dependencies
- // Although dependences are validated before mods are loaded, a dependency may have failed.
+ // Although dependences are validated before mods are loaded, a dependency may have failed to load.
if (mod.Manifest.Dependencies?.Any() == true)
{
foreach (IManifestDependency dependency in mod.Manifest.Dependencies)
@@ -955,7 +955,6 @@ namespace StardewModdingAPI.Framework
catch (IncompatibleInstructionException) // details already in trace logs
{
string[] updateUrls = new[] { modDatabase.GetModPageUrlFor(manifest.UniqueID), "https://smapi.io/compat" }.Where(p => p != null).ToArray();
-
errorReasonPhrase = $"it's no longer compatible. Please check for a new version at {string.Join(" or ", updateUrls)}.";
return false;
}
@@ -1050,13 +1049,18 @@ namespace StardewModdingAPI.Framework
this.Monitor.Log(" These mods could not be added to your game.", LogLevel.Error);
this.Monitor.Newline();
+ HashSet<string> logged = new HashSet<string>();
foreach (var pair in skippedMods.OrderBy(p => p.Key.DisplayName))
{
IModMetadata mod = pair.Key;
string errorReason = pair.Value.Item1;
string errorDetails = pair.Value.Item2;
+ string message = $" - {mod.DisplayName}{(mod.Manifest?.Version != null ? " " + mod.Manifest.Version.ToString() : "")} because {errorReason}";
+
+ if (!logged.Add($"{message}|{errorDetails}"))
+ continue; // skip duplicate messages (e.g. if multiple copies of the mod are installed)
- this.Monitor.Log($" - {mod.DisplayName}{(mod.Manifest?.Version != null ? " " + mod.Manifest.Version.ToString() : "")} because {errorReason}", LogLevel.Error);
+ this.Monitor.Log(message, LogLevel.Error);
if (errorDetails != null)
this.Monitor.Log($" ({errorDetails})", LogLevel.Trace);
}