Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Property for recursive mod loading #994

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.EnumSet;

import net.fabricmc.loader.impl.util.LoaderUtil;
import net.fabricmc.loader.impl.util.SystemProperties;
import net.fabricmc.loader.impl.util.log.Log;
import net.fabricmc.loader.impl.util.log.LogCategory;

Expand Down Expand Up @@ -54,10 +55,12 @@ public void findCandidates(ModCandidateConsumer out) {
}

try {
Files.walkFileTree(this.path, EnumSet.of(FileVisitOption.FOLLOW_LINKS), 1, new SimpleFileVisitor<Path>() {
Files.walkFileTree(this.path, EnumSet.of(FileVisitOption.FOLLOW_LINKS), System.getProperty(SystemProperties.LOAD_MODS_RECURSIVELY) != null ? Integer.MAX_VALUE : 1, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (isValidFile(file)) {
if (file.getParent() != null && file.getParent().toString().contains("disabled")) {
return FileVisitResult.SKIP_SUBTREE;
} else if (isValidFile(file)) {
out.accept(file, requiresRemap);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public final class SystemProperties {
public static final String LOG_LEVEL = "fabric.log.level";
// a path to a directory to replace the default mod search directory
public static final String MODS_FOLDER = "fabric.modsFolder";
// whether to load mods recursively from the mods folder. Paths that contain "disabled" are ignored
public static final String LOAD_MODS_RECURSIVELY = "fabric.loadModsRecursively";
// additional mods to load (path separator separated paths, @ prefix for meta-file with each line referencing an actual file)
public static final String ADD_MODS = "fabric.addMods";
// a comma-separated list of mod ids to disable, even if they're discovered. mostly useful for unit testing.
Expand Down