Skip to content

Commit eab151a

Browse files
author
Swamp Ig
committed
Allow GameData subdirs in NEEDS / BEFORE / AFTER
1 parent a19da63 commit eab151a

File tree

2 files changed

+29
-16
lines changed

2 files changed

+29
-16
lines changed

Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
1818
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
1919

20-
[assembly: AssemblyVersion("2.1.3")]
20+
[assembly: AssemblyVersion("2.1.4")]
2121

2222
// The following attributes are used to specify the signing key for the assembly,
2323
// if desired. See the Mono documentation for more information about signing.

moduleManager.cs

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -162,27 +162,40 @@ orderby ass.GetName().Version descending, a.path ascending
162162
{
163163
modlist += " " + mod.Name + " v" + mod.Version.ToString() + "\n";
164164
}
165-
modlist += "Non-DLL mods added:";
165+
modlist += "Non-DLL mods added:\n";
166166
foreach (UrlDir.UrlConfig cfgmod in GameDatabase.Instance.root.AllConfigs)
167167
{
168-
if (cfgmod.type[0] == '@' || (cfgmod.type[0] == '$'))
168+
string name;
169+
if (ParseCommand(cfgmod.type, out name) != Command.Insert && name.Contains(":FOR["))
169170
{
170-
string name = RemoveWS(cfgmod.name);
171-
if (name.Contains(":FOR["))
172-
{ // check for FOR[] blocks that don't match loaded DLLs and add them to the pass list
173-
174-
string dependency = name.Substring(name.IndexOf(":FOR[") + 5);
175-
dependency = dependency.Substring(0, dependency.IndexOf(']'));
176-
if (mods.Find(a => RemoveWS(a.Name.ToUpper()).Equals(RemoveWS(dependency.ToUpper()))) == null)
177-
{ // found one, now add it to the list.
178-
AssemblyName newMod = new AssemblyName(dependency);
179-
newMod.Name = dependency;
180-
mods.Add(newMod);
181-
modlist += "\n " + dependency;
182-
}
171+
name = RemoveWS(name);
172+
// check for FOR[] blocks that don't match loaded DLLs and add them to the pass list
173+
174+
string dependency = name.Substring(name.IndexOf(":FOR[") + 5);
175+
dependency = dependency.Substring(0, dependency.IndexOf(']'));
176+
if (mods.Find(a => RemoveWS(a.Name.ToUpper()).Equals(RemoveWS(dependency.ToUpper()))) == null)
177+
{ // found one, now add it to the list.
178+
AssemblyName newMod = new AssemblyName(dependency);
179+
newMod.Name = dependency;
180+
mods.Add(newMod);
181+
modlist += " " + dependency + "\n";
183182
}
184183
}
185184
}
185+
modlist += "Mods by directory (subdirs of GameData):\n";
186+
string gameData = Path.Combine(Path.GetFullPath(KSPUtil.ApplicationRootPath), "GameData");
187+
foreach (string subdir in Directory.GetDirectories(gameData))
188+
{
189+
string name = Path.GetFileName(subdir);
190+
string upperName = RemoveWS(name.ToUpper());
191+
if (mods.Find(a => RemoveWS(a.Name.ToUpper()) == upperName) == null)
192+
{
193+
AssemblyName newMod = new AssemblyName(name);
194+
newMod.Name = name;
195+
mods.Add(newMod);
196+
modlist += " " + name + "\n";
197+
}
198+
}
186199
log(modlist);
187200
#endregion
188201

0 commit comments

Comments
 (0)