Skip to content

Commit

Permalink
Update MelonFolderHandler.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
HerpDerpinstine committed Oct 14, 2024
1 parent 29d0771 commit 7828f4e
Showing 1 changed file with 31 additions and 21 deletions.
52 changes: 31 additions & 21 deletions MelonLoader/Melons/MelonFolderHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,31 +99,41 @@ private static void ProcessFolder<T>(string path,

// Get Directories
var directories = Directory.GetDirectories(path, "*", SearchOption.AllDirectories);

// Load UserLibs
foreach (var dir in directories)
if ((directories != null) && (directories.Length > 0))
{
// Skip any folders that doesn't end with or isn't equal to UserLibs
string dirName = new DirectoryInfo(dir).Name;
string dirNameLower = dirName.ToLowerInvariant();
if (!dirNameLower.EndsWith("userlibs"))
continue;
// Load UserLibs
foreach (var dir in directories)
{
// Validate Path
if (!Directory.Exists(dir))
continue;

// Load Assemblies
LoadFolder<T>(dir, false, ref hasWroteLine, ref melonAssemblies);
}
// Skip any folders that doesn't end with or isn't equal to UserLibs
string dirName = new DirectoryInfo(dir).Name;
string dirNameLower = dirName.ToLowerInvariant();
if (!dirNameLower.EndsWith("userlibs"))
continue;

// Load Melons from Extended Folders
foreach (var dir in directories)
{
// Skip any folders that ends with or is equal to Disabled
string dirName = new DirectoryInfo(dir).Name;
string dirNameLower = dirName.ToLowerInvariant();
if (dirNameLower.EndsWith("disabled"))
continue;
// Load Assemblies
LoadFolder<T>(dir, false, ref hasWroteLine, ref melonAssemblies);
}

// Load Melons from Extended Folders
foreach (var dir in directories)
{
// Validate Path
if (!Directory.Exists(dir))
continue;

// Load Assemblies
LoadFolder<T>(dir, true, ref hasWroteLine, ref melonAssemblies);
// Skip any folders that ends with or is equal to Disabled
string dirName = new DirectoryInfo(dir).Name;
string dirNameLower = dirName.ToLowerInvariant();
if (dirNameLower.EndsWith("disabled"))
continue;

// Load Melons from Extended Folder
LoadFolder<T>(dir, true, ref hasWroteLine, ref melonAssemblies);
}
}

// Load Melons from Base Path
Expand Down

0 comments on commit 7828f4e

Please sign in to comment.