Disable ANSI when gradle's --console plain arg is used Fixes #486
This commit is contained in:
		
							parent
							
								
									8da2da8aed
								
							
						
					
					
						commit
						aaf8653bee
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		|  | @ -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"); | ||||
| 		} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue