summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI.Toolkit
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI.Toolkit')
-rw-r--r--src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModFolder.cs7
-rw-r--r--src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs6
2 files changed, 11 insertions, 2 deletions
diff --git a/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModFolder.cs b/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModFolder.cs
index d2fea9e2..bb467b36 100644
--- a/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModFolder.cs
+++ b/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModFolder.cs
@@ -24,6 +24,9 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
/// <summary>The error which occurred parsing the manifest, if any.</summary>
public string ManifestParseError { get; }
+ /// <summary>Whether the mod should be loaded by default. This is <c>false</c> if it was found within a folder whose name starts with a dot.</summary>
+ public bool ShouldBeLoaded { get; }
+
/*********
** Public methods
@@ -33,12 +36,14 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
/// <param name="directory">The folder containing the mod's manifest.json.</param>
/// <param name="manifest">The mod manifest.</param>
/// <param name="manifestParseError">The error which occurred parsing the manifest, if any.</param>
- public ModFolder(DirectoryInfo root, DirectoryInfo directory, Manifest manifest, string manifestParseError = null)
+ /// <param name="shouldBeLoaded">Whether the mod should be loaded by default. This should be <c>false</c> if it was found within a folder whose name starts with a dot.</param>
+ public ModFolder(DirectoryInfo root, DirectoryInfo directory, Manifest manifest, string manifestParseError = null, bool shouldBeLoaded = true)
{
// save info
this.Directory = directory;
this.Manifest = manifest;
this.ManifestParseError = manifestParseError;
+ this.ShouldBeLoaded = shouldBeLoaded;
// set display name
this.DisplayName = manifest?.Name;
diff --git a/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs b/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs
index 2c23a3ce..106c294f 100644
--- a/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs
+++ b/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs
@@ -102,8 +102,12 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
/// <param name="folder">The folder to search for mods.</param>
public IEnumerable<ModFolder> GetModFolders(DirectoryInfo root, DirectoryInfo folder)
{
+ // skip
+ if (folder.FullName != root.FullName && folder.Name.StartsWith("."))
+ yield return new ModFolder(root, folder, null, "ignored folder because its name starts with a dot.", shouldBeLoaded: false);
+
// recurse into subfolders
- if (this.IsModSearchFolder(root, folder))
+ else if (this.IsModSearchFolder(root, folder))
{
foreach (DirectoryInfo subfolder in folder.EnumerateDirectories())
{