Skip to content

Commit

Permalink
Error on the coexistence of QMJ and QMJ5
Browse files Browse the repository at this point in the history
  • Loading branch information
EnnuiL committed Jul 9, 2023
1 parent 4e2187a commit 9a8d821
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,28 @@ private ModLoadOption[] scan0(Path root, QuiltLoaderIcon fileIcon, ModLocation l

if (FasterFiles.exists(qmj5)) {
if (QuiltLoader.isDevelopmentEnvironment()) {
if (FasterFiles.exists(qmj)) {
QuiltLoaderText title = QuiltLoaderText.translate("gui.text.qmj_and_qmj5_coexistence.title");
QuiltDisplayedError error = context().reportError(title);
String describedPath = context().manager().describePath(usedQmj);
error.appendReportText(
"A coexistence of 'quilt.mod.json5' and 'quilt.mod.json' has been detected at " + describedPath,
"These metadata files cannot coexist with each other due to their conflicting purposes!"
);
error.appendDescription(
QuiltLoaderText.translate("gui.text.qmj_and_qmj5_coexistence.desc.0"),
QuiltLoaderText.translate("gui.text.qmj_and_qmj5_coexistence.desc.1"),
QuiltLoaderText.translate("gui.text.qmj_and_qmj5_coexistence.desc.2", describedPath)
);
context().manager().getRealContainingFile(root).ifPresent(real ->
error.addFileViewButton(real)
.icon(QuiltLoaderGui.iconJarFile().withDecoration(QuiltLoaderGui.iconQuilt()))
);

guiNode.addChild(QuiltLoaderText.translate("gui.text.qmj_and_qmj5_coexistence"));
return null;
}

usedQmj = qmj5;
} else {
QuiltLoaderText title = QuiltLoaderText.translate("gui.text.qmj5_on_production.title");
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/lang/quilt_loader.properties
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ gui.text.qmj5_on_production.title=Attempted to read an unconverted 'quilt.mod.js
gui.text.qmj5_on_production.desc.0=An attempt to read a 'quilt.mod.json5' file was detected!
gui.text.qmj5_on_production.desc.1='quilt.mod.json5' files can't be used outside a development environment without converting to a 'quilt.mod.json' file!
gui.text.qmj5_on_production.desc.2=From %s
gui.text.qmj_and_qmj5_coexistence=Coexistence of conflicting Quilt metadata found
gui.text.qmj_and_qmj5_coexistence.title=Detected the coexistence of conflicting metadata!
gui.text.qmj_and_qmj5_coexistence.desc.0=A coexistence of 'quilt.mod.json5' and 'quilt.mod.json' has been detected.
gui.text.qmj_and_qmj5_coexistence.desc.1=These metadata files cannot coexist with each other due to their conflicting purposes!
gui.text.qmj_and_qmj5_coexistence.desc.2=From %s
error.unhandled_solver=Complex solver error; see the crash report for more information
error.unhandled_solver.desc=Please try updating quilt-loader to see if an update can describe this.\nOr report this to the quilt-loader project so this can be fixed.
error.unhandled_solver.desc.rule_n= \n \nRule %s (%s):
Expand Down

0 comments on commit 9a8d821

Please sign in to comment.