diff --git a/tools/utils/PlatformSetup.hx b/tools/utils/PlatformSetup.hx index 93d84cf6c..37fb94bd4 100644 --- a/tools/utils/PlatformSetup.hx +++ b/tools/utils/PlatformSetup.hx @@ -816,99 +816,101 @@ class PlatformSetup setupHaxelib(new Haxelib("lime")); } - if (!targetFlags.exists("noalias")) - { - var haxePath = Sys.getEnv("HAXEPATH"); - - if (System.hostPlatform == WINDOWS) - { - if (haxePath == null || haxePath == "") - { - haxePath = "C:\\HaxeToolkit\\haxe\\"; - } - - try - { - File.copy(Haxelib.getPath(new Haxelib("lime")) + "\\templates\\\\bin\\lime.exe", haxePath + "\\lime.exe"); - } - catch (e:Dynamic) {} - try - { - File.copy(Haxelib.getPath(new Haxelib("lime")) + "\\templates\\\\bin\\lime.sh", haxePath + "\\lime"); - } - catch (e:Dynamic) {} - } - else - { - if (haxePath == null || haxePath == "") - { - haxePath = "/usr/lib/haxe"; - } - - var installedCommand = false; - var answer = YES; - - if (targetFlags.exists("y")) - { - Sys.println("Do you want to install the \"lime\" command? [y/n/a] y"); - } - else - { - answer = CLIHelper.ask("Do you want to install the \"lime\" command?"); - } - - if (answer == YES || answer == ALWAYS) - { - if (System.hostPlatform == MAC) - { - try - { - System.runCommand("", "cp", [ - "-f", - Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh", - "/usr/local/bin/lime" - ], false); - System.runCommand("", "chmod", ["755", "/usr/local/bin/lime"], false); - installedCommand = true; - } - catch (e:Dynamic) {} - } - else - { - try - { - System.runCommand("", "sudo", [ - "cp", - "-f", - Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh", - "/usr/local/bin/lime" - ], false); - System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/lime"], false); - installedCommand = true; - } - catch (e:Dynamic) {} - } - } - - if (!installedCommand) - { - Sys.println(""); - Sys.println("To finish setup, we recommend you either..."); - Sys.println(""); - Sys.println(" a) Manually add an alias called \"lime\" to run \"haxelib run lime\""); - Sys.println(" b) Run the following commands:"); - Sys.println(""); - Sys.println("sudo cp \"" + Path.combine(Haxelib.getPath(new Haxelib("lime")), "templates/bin/lime.sh") + "\" /usr/local/bin/lime"); - Sys.println("sudo chmod 755 /usr/local/bin/lime"); - Sys.println(""); - } - } - } - if (System.hostPlatform == MAC) { ConfigHelper.writeConfigValue("MAC_USE_CURRENT_SDK", "1"); } + + if (!targetFlags.exists("noalias")) + { + return; + } + + var haxePath = Sys.getEnv("HAXEPATH"); + + if (System.hostPlatform == WINDOWS) + { + if (haxePath == null || haxePath == "") + { + haxePath = "C:\\HaxeToolkit\\haxe\\"; + } + + try + { + File.copy(Haxelib.getPath(new Haxelib("lime")) + "\\templates\\\\bin\\lime.exe", haxePath + "\\lime.exe"); + } + catch (e:Dynamic) {} + try + { + File.copy(Haxelib.getPath(new Haxelib("lime")) + "\\templates\\\\bin\\lime.sh", haxePath + "\\lime"); + } + catch (e:Dynamic) {} + } + else + { + if (haxePath == null || haxePath == "") + { + haxePath = "/usr/lib/haxe"; + } + + var installedCommand = false; + var answer = YES; + + if (targetFlags.exists("y")) + { + Sys.println("Do you want to install the \"lime\" command? [y/n/a] y"); + } + else + { + answer = CLIHelper.ask("Do you want to install the \"lime\" command?"); + } + + if (answer == YES || answer == ALWAYS) + { + if (System.hostPlatform == MAC) + { + try + { + System.runCommand("", "cp", [ + "-f", + Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh", + "/usr/local/bin/lime" + ], false); + System.runCommand("", "chmod", ["755", "/usr/local/bin/lime"], false); + installedCommand = true; + } + catch (e:Dynamic) {} + } + else + { + try + { + System.runCommand("", "sudo", [ + "cp", + "-f", + Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh", + "/usr/local/bin/lime" + ], false); + System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/lime"], false); + installedCommand = true; + } + catch (e:Dynamic) {} + } + } + + if (!installedCommand) + { + Sys.println(""); + Sys.println("To finish setup, we recommend you either..."); + Sys.println(""); + Sys.println(" a) Manually add an alias called \"lime\" to run \"haxelib run lime\""); + Sys.println(" b) Run the following commands:"); + Sys.println(""); + Sys.println("sudo cp \"" + Path.combine(Haxelib.getPath(new Haxelib("lime")), "templates/bin/lime.sh") + "\" /usr/local/bin/lime"); + Sys.println("sudo chmod 755 /usr/local/bin/lime"); + Sys.println(""); + } + } } public static function setupLinux():Void @@ -1039,128 +1041,130 @@ class PlatformSetup setupHaxelib(new Haxelib("openfl")); } - if (!targetFlags.exists("noalias")) - { - var haxePath = Sys.getEnv("HAXEPATH"); - var project = null; - - try - { - project = HXProject.fromHaxelib(new Haxelib("openfl")); - } - catch (e:Dynamic) {} - - if (System.hostPlatform == WINDOWS) - { - if (haxePath == null || haxePath == "") - { - haxePath = "C:\\HaxeToolkit\\haxe\\"; - } - - try - { - File.copy(Haxelib.getPath(new Haxelib("lime")) + "\\templates\\\\bin\\lime.exe", haxePath + "\\lime.exe"); - } - catch (e:Dynamic) {} - try - { - File.copy(Haxelib.getPath(new Haxelib("lime")) + "\\templates\\\\bin\\lime.sh", haxePath + "\\lime"); - } - catch (e:Dynamic) {} - - try - { - System.copyFileTemplate(project.templatePaths, "bin/openfl.exe", haxePath + "\\openfl.exe"); - System.copyFileTemplate(project.templatePaths, "bin/openfl.sh", haxePath + "\\openfl"); - } - catch (e:Dynamic) {} - } - else - { - if (haxePath == null || haxePath == "") - { - haxePath = "/usr/lib/haxe"; - } - - var installedCommand = false; - var answer = YES; - - if (targetFlags.exists("y")) - { - Sys.println("Do you want to install the \"openfl\" command? [y/n/a] y"); - } - else - { - answer = CLIHelper.ask("Do you want to install the \"openfl\" command?"); - } - - if (answer == YES || answer == ALWAYS) - { - if (System.hostPlatform == MAC) - { - try - { - System.runCommand("", "cp", [ - "-f", - Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh", - "/usr/local/bin/lime" - ], false); - System.runCommand("", "chmod", ["755", "/usr/local/bin/lime"], false); - System.runCommand("", "cp", [ - "-f", - System.findTemplate(project.templatePaths, "bin/openfl.sh"), - "/usr/local/bin/openfl" - ], false); - System.runCommand("", "chmod", ["755", "/usr/local/bin/openfl"], false); - installedCommand = true; - } - catch (e:Dynamic) {} - } - else - { - try - { - System.runCommand("", "sudo", [ - "cp", - "-f", - Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh", - "/usr/local/bin/lime" - ], false); - System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/lime"], false); - System.runCommand("", "sudo", [ - "cp", - "-f", - System.findTemplate(project.templatePaths, "bin/openfl.sh"), - "/usr/local/bin/openfl" - ], false); - System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/openfl"], false); - installedCommand = true; - } - catch (e:Dynamic) {} - } - } - - if (!installedCommand) - { - Sys.println(""); - Sys.println("To finish setup, we recommend you either..."); - Sys.println(""); - Sys.println(" a) Manually add an alias called \"openfl\" to run \"haxelib run openfl\""); - Sys.println(" b) Run the following commands:"); - Sys.println(""); - Sys.println("sudo cp \"" + Path.combine(Haxelib.getPath(new Haxelib("lime")), "templates/bin/lime.sh") + "\" /usr/local/bin/lime"); - Sys.println("sudo chmod 755 /usr/local/bin/lime"); - Sys.println("sudo cp \"" + System.findTemplate(project.templatePaths, "bin/openfl.sh") + "\" /usr/local/bin/openfl"); - Sys.println("sudo chmod 755 /usr/local/bin/openfl"); - Sys.println(""); - } - } - } - if (System.hostPlatform == MAC) { ConfigHelper.writeConfigValue("MAC_USE_CURRENT_SDK", "1"); } + + if (targetFlags.exists("noalias")) + { + return; + } + + var haxePath = Sys.getEnv("HAXEPATH"); + var project = null; + + try + { + project = HXProject.fromHaxelib(new Haxelib("openfl")); + } + catch (e:Dynamic) {} + + if (System.hostPlatform == WINDOWS) + { + if (haxePath == null || haxePath == "") + { + haxePath = "C:\\HaxeToolkit\\haxe\\"; + } + + try + { + File.copy(Haxelib.getPath(new Haxelib("lime")) + "\\templates\\\\bin\\lime.exe", haxePath + "\\lime.exe"); + } + catch (e:Dynamic) {} + try + { + File.copy(Haxelib.getPath(new Haxelib("lime")) + "\\templates\\\\bin\\lime.sh", haxePath + "\\lime"); + } + catch (e:Dynamic) {} + + try + { + System.copyFileTemplate(project.templatePaths, "bin/openfl.exe", haxePath + "\\openfl.exe"); + System.copyFileTemplate(project.templatePaths, "bin/openfl.sh", haxePath + "\\openfl"); + } + catch (e:Dynamic) {} + } + else + { + if (haxePath == null || haxePath == "") + { + haxePath = "/usr/lib/haxe"; + } + + var installedCommand = false; + var answer = YES; + + if (targetFlags.exists("y")) + { + Sys.println("Do you want to install the \"openfl\" command? [y/n/a] y"); + } + else + { + answer = CLIHelper.ask("Do you want to install the \"openfl\" command?"); + } + + if (answer == YES || answer == ALWAYS) + { + if (System.hostPlatform == MAC) + { + try + { + System.runCommand("", "cp", [ + "-f", + Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh", + "/usr/local/bin/lime" + ], false); + System.runCommand("", "chmod", ["755", "/usr/local/bin/lime"], false); + System.runCommand("", "cp", [ + "-f", + System.findTemplate(project.templatePaths, "bin/openfl.sh"), + "/usr/local/bin/openfl" + ], false); + System.runCommand("", "chmod", ["755", "/usr/local/bin/openfl"], false); + installedCommand = true; + } + catch (e:Dynamic) {} + } + else + { + try + { + System.runCommand("", "sudo", [ + "cp", + "-f", + Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh", + "/usr/local/bin/lime" + ], false); + System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/lime"], false); + System.runCommand("", "sudo", [ + "cp", + "-f", + System.findTemplate(project.templatePaths, "bin/openfl.sh"), + "/usr/local/bin/openfl" + ], false); + System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/openfl"], false); + installedCommand = true; + } + catch (e:Dynamic) {} + } + } + + if (!installedCommand) + { + Sys.println(""); + Sys.println("To finish setup, we recommend you either..."); + Sys.println(""); + Sys.println(" a) Manually add an alias called \"openfl\" to run \"haxelib run openfl\""); + Sys.println(" b) Run the following commands:"); + Sys.println(""); + Sys.println("sudo cp \"" + Path.combine(Haxelib.getPath(new Haxelib("lime")), "templates/bin/lime.sh") + "\" /usr/local/bin/lime"); + Sys.println("sudo chmod 755 /usr/local/bin/lime"); + Sys.println("sudo cp \"" + System.findTemplate(project.templatePaths, "bin/openfl.sh") + "\" /usr/local/bin/openfl"); + Sys.println("sudo chmod 755 /usr/local/bin/openfl"); + Sys.println(""); + } + } } public static function setupWebAssembly():Void