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

feat: add ability to customize fabric directories #671

Closed
wants to merge 1 commit into from

Conversation

zebp
Copy link

@zebp zebp commented May 3, 2022

Adds the ability to customize the mods and config directories via the fabric.dir.mods and fabric.dir.config Java properties. This can allow for different launcher profiles to have different mod directories so users don't need to install third party launchers to fix conflicting mods or config directories while keeping all of their settings, screenshots, and other preferences the same.

This is very similar to the functionality landed in #470 and the proposed changes in #512 so this might be unnecessary, but addresses the issue of potential breaking changes in configs between mod versions.

Adds the ability to customize the "mods" and "config" directories via
the "fabric.dir.mods" and "fabric.dir.config" Java properties. This
can allow for different launcher profiles to have different mod
directories so users don't need to install third party launchers to fix
conflicting mods or config directories while keeping all of their
settings, screenshots, and other preferences the same.

In the future, it might be a good idea to add a way to customize this in
the fabric installer.
@frqnny
Copy link

frqnny commented May 3, 2022

Is there a debug log or just a normal level log that can output what directory FLoader will use? It might be a good idea in case of bug reports and debugging in the future due to this change.

@zebp
Copy link
Author

zebp commented May 3, 2022

Is there a debug log or just a normal level log that can output what directory FLoader will use? It might be a good idea in case of bug reports and debugging in the future due to this change.

No, but that seems like it might be a good idea.

@modmuss50
Copy link
Member

I think there are 2 things to look at here, moving the mods dir, and moving the config dir.

mods

I'm in two minds about this, the main reason we never had versioned mod folders was to try and prevent people from loading the wrong save. (Id need to go and find the issue about it to be sure) This will suffer from the same issue.

However as you noted #470 basically does the same thing, this was more designed for launchers to have a central repo of mods for each modpack. But can easily serve the same as what this PR is trying to do. Personally I dont think its really needed.

configs

Moving the config dir isn't something I have seen much request for and im not too sure how effective it would be. As mods may use the gamedir/rundir and/or not even store their data in the config dir. Personally I dont think there is a lot of benefit in having this?

Most if not all launchers (including the offical one!) support creating seprate instances in a much more user friendly way than what this PR provides. I think if a user does want to share the screenshots folder (as mentioned in this PR, but not solved) for example, using the operating systems featues to create a symlink would be a better solution.

Even vanilla Minecraft does not support loading newer config/options files in older versions of the game, its not something I would expect mods to support, in a worse case creating hard to debug issues. I still think having a clean split between each profile is good.

@liach
Copy link
Contributor

liach commented May 3, 2022

Note that there is nothing preventing a mod obtaining the game directory and putting its data under any arbitrary path, and the game directory is easily obtainable when there is a Minecraft client/server instance. This doesn't solve the problem you describe, but may introduce many more subtle problems.

@liach
Copy link
Contributor

liach commented May 3, 2022

A popular assumption on the safety of config-sharing is that the loader and the mods will not alter the config or the mods directories. While such behavior is true for reading command-line flags, including loading mods from command-line, log4j's loading of config, unfortunately, fabric (and even vanilla, remember how auto-jump is enabled when you launch 1.8.9 once?) does not operate under this model.

If you wish safety for directory customization to facilitate sharing, I recommend implementing it in a way so we disallow modifying the shared directory, such as copying the given directory over on launch.

@sfPlayer1
Copy link
Contributor

I don't really mind making the directories configurable this way for special purposes, the way it is configured already targets advanced users.

Disabling the mods directory should be possible too, maybe if the system property is an empty string? Config dir is not optional.

@NebelNidas
Copy link
Member

I'm bumping this. While I fully agree with modmuss that separate game profiles/directories should be preferred over this, there are some edge cases where changing the mods directory is useful.
Iris for example wants to provide an Optifine-like installer: Either create a full-fat modded profile with Fabric and Iris within, or "just install Iris". Now, the latter option of course also installs Fabric behind the scenes, but it's completely invisible to the user, they just see an Iris profile (even the Fabric watermarks are removed).
The thing is, when you "just install Iris" into an existing folder that may already contain Forge mods, and later launch the Forge profile, it will complain about a Fabric mod (Iris) being there, which will confuse unexperienced users who opted to "just install Iris". Optimally, the Iris Installer could install the Iris JAR into a different directory (not mods) and tell Fabric Loader where the correct location is, which this PR would allow for. Quilt does so, too, hence the discussions in the Iris Discord of moving to Quilt instead if Fabric won't allow a similar feature soon.

@modmuss50
Copy link
Member

This should already be possible using the -Dfabric.addMods property https://github.com/FabricMC/fabric-loader/blob/master/src/main/java/net/fabricmc/loader/impl/util/SystemProperties.java#L35-L36

The installer would download the normal mod jar to a location outside of /mods and then pass that to loader via the launcher profile it created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants