summaryrefslogtreecommitdiff
path: root/src/SMAPI.Toolkit/Framework/ModScanning/ModFolder.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-07 02:33:23 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-07 02:33:23 -0400
commitd706a25053cdc5d9f1ccc2c09dc3913f835c3f78 (patch)
treebb628c31b328e46d8aa7ae4c521f5f76bdfcbd38 /src/SMAPI.Toolkit/Framework/ModScanning/ModFolder.cs
parent6b05296e71c32abd158f354eeeaf1e135e72e6e2 (diff)
downloadSMAPI-d706a25053cdc5d9f1ccc2c09dc3913f835c3f78.tar.gz
SMAPI-d706a25053cdc5d9f1ccc2c09dc3913f835c3f78.tar.bz2
SMAPI-d706a25053cdc5d9f1ccc2c09dc3913f835c3f78.zip
enable nullable annotations for most of the SMAPI toolkit (#837)
Diffstat (limited to 'src/SMAPI.Toolkit/Framework/ModScanning/ModFolder.cs')
-rw-r--r--src/SMAPI.Toolkit/Framework/ModScanning/ModFolder.cs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/SMAPI.Toolkit/Framework/ModScanning/ModFolder.cs b/src/SMAPI.Toolkit/Framework/ModScanning/ModFolder.cs
index 81d72c0b..da2a3c85 100644
--- a/src/SMAPI.Toolkit/Framework/ModScanning/ModFolder.cs
+++ b/src/SMAPI.Toolkit/Framework/ModScanning/ModFolder.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -24,13 +22,13 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
public ModType Type { get; }
/// <summary>The mod manifest.</summary>
- public Manifest Manifest { get; }
+ public Manifest? Manifest { get; }
/// <summary>The error which occurred parsing the manifest, if any.</summary>
public ModParseError ManifestParseError { get; set; }
/// <summary>A human-readable message for the <see cref="ManifestParseError"/>, if any.</summary>
- public string ManifestParseErrorText { get; set; }
+ public string? ManifestParseErrorText { get; set; }
/*********
@@ -51,7 +49,7 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
/// <param name="manifest">The mod manifest.</param>
/// <param name="manifestParseError">The error which occurred parsing the manifest, if any.</param>
/// <param name="manifestParseErrorText">A human-readable message for the <paramref name="manifestParseError"/>, if any.</param>
- public ModFolder(DirectoryInfo root, DirectoryInfo directory, ModType type, Manifest manifest, ModParseError manifestParseError, string manifestParseErrorText)
+ public ModFolder(DirectoryInfo root, DirectoryInfo directory, ModType type, Manifest? manifest, ModParseError manifestParseError, string? manifestParseErrorText)
{
// save info
this.Directory = directory;
@@ -61,9 +59,9 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
this.ManifestParseErrorText = manifestParseErrorText;
// set display name
- this.DisplayName = manifest?.Name;
- if (string.IsNullOrWhiteSpace(this.DisplayName))
- this.DisplayName = PathUtilities.GetRelativePath(root.FullName, directory.FullName);
+ this.DisplayName = !string.IsNullOrWhiteSpace(manifest?.Name)
+ ? manifest.Name
+ : PathUtilities.GetRelativePath(root.FullName, directory.FullName);
}
/// <summary>Get the update keys for a mod.</summary>