mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-30 13:05:27 -05:00
Disable ANSI when gradle's --console plain arg is used Fixes #486
This commit is contained in:
@@ -40,6 +40,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.logging.configuration.ConsoleOutput;
|
||||
import org.gradle.api.plugins.JavaPlugin;
|
||||
|
||||
import net.fabricmc.loom.configuration.DependencyProvider;
|
||||
@@ -66,10 +67,13 @@ public class LaunchProvider extends DependencyProvider {
|
||||
.argument("client", "--assetsDir")
|
||||
.argument("client", new File(getDirectories().getUserCache(), "assets").getAbsolutePath());
|
||||
|
||||
//Enable ansi by default for idea and vscode
|
||||
if (new File(getProject().getRootDir(), ".vscode").exists()
|
||||
final boolean plainConsole = getProject().getGradle().getStartParameter().getConsoleOutput() == ConsoleOutput.Plain;
|
||||
final boolean ansiSupportedIDE = new File(getProject().getRootDir(), ".vscode").exists()
|
||||
|| new File(getProject().getRootDir(), ".idea").exists()
|
||||
|| (Arrays.stream(getProject().getRootDir().listFiles()).anyMatch(file -> file.getName().endsWith(".iws")))) {
|
||||
|| (Arrays.stream(getProject().getRootDir().listFiles()).anyMatch(file -> file.getName().endsWith(".iws")));
|
||||
|
||||
//Enable ansi by default for idea and vscode when gradle is not ran with plain console.
|
||||
if (ansiSupportedIDE && !plainConsole) {
|
||||
launchConfig.property("fabric.log.disableAnsi", "false");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user