Skip to content
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
15 changes: 12 additions & 3 deletions src/main/java/net/fabricmc/loader/impl/FabricLoaderImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.function.Consumer;
import java.util.stream.Collectors;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.VisibleForTesting;
import org.objectweb.asm.Opcodes;

Expand Down Expand Up @@ -135,7 +136,7 @@ public void setGameProvider(GameProvider provider) {

private void setGameDir(Path gameDir) {
this.gameDir = gameDir.toAbsolutePath().normalize();
this.configDir = gameDir.resolve("config");
this.configDir = getConfigDirectory0();
}

@Override
Expand Down Expand Up @@ -617,9 +618,17 @@ public String[] getLaunchArguments(boolean sanitize) {

@Override
protected Path getModsDirectory0() {
String directory = System.getProperty(SystemProperties.MODS_FOLDER);
return getConfiguredOrRelativeDirectory(SystemProperties.MODS_FOLDER, "mods");
}

private Path getConfigDirectory0() {
return getConfiguredOrRelativeDirectory(SystemProperties.CONFIG_FOLDER, "config");
}

private @NotNull Path getConfiguredOrRelativeDirectory(String systemProperty, String fallbackName) {
String directory = System.getProperty(systemProperty);

return directory != null ? Paths.get(directory) : gameDir.resolve("mods");
return directory != null ? Paths.get(directory) : gameDir.resolve(fallbackName);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public final class SystemProperties {
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.
public static final String DISABLE_MOD_IDS = "fabric.debug.disableModIds";
// a path to a directory to replace the default mod config directory
public static final String CONFIG_FOLDER = "fabric.configFolder";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move this next to the modsFolder property, probably above it

// file containing the class path for in-dev runtime mod remapping
public static final String REMAP_CLASSPATH_FILE = "fabric.remapClasspathFile";
// class path groups to map multiple class path entries to a mod (paths separated by path separator, groups by double path separator)
Expand Down