PlatformSetup: in verbose mode, failure to install lime alias logs a warning

On Windows, if HAXEPATH is not set, but it probably should be, and installing the alias fails, logs a warning suggesting to set HAXEPATH
This commit is contained in:
Josh Tynjala
2024-02-08 14:29:04 -08:00
parent 4ed893afbd
commit c9605ee784

View File

@@ -816,25 +816,49 @@ class PlatformSetup
setupHaxelib(new Haxelib("lime"));
}
var haxePath = Sys.getEnv("HAXEPATH");
var haxePathEnv = Sys.getEnv("HAXEPATH");
var haxePath = haxePathEnv;
if (System.hostPlatform == WINDOWS)
{
var usingDefaultHaxePath = false;
if (haxePath == null || haxePath == "")
{
usingDefaultHaxePath = true;
haxePath = "C:\\HaxeToolkit\\haxe\\";
}
var copyFailure = false;
var exeDestPath = haxePath + "\\lime.exe";
try
{
File.copy(Haxelib.getPath(new Haxelib("lime")) + "\\templates\\\\bin\\lime.exe", haxePath + "\\lime.exe");
File.copy(Haxelib.getPath(new Haxelib("lime")) + "\\templates\\\\bin\\lime.exe", exeDestPath);
}
catch (e:Dynamic) {}
catch (e:Dynamic)
{
copyFailure = true;
if (Log.verbose)
{
Log.warn("Failed to copy lime.exe alias to destination: " + exeDestPath);
}
}
var shDestPath = haxePath + "\\lime";
try
{
File.copy(Haxelib.getPath(new Haxelib("lime")) + "\\templates\\\\bin\\lime.sh", haxePath + "\\lime");
File.copy(Haxelib.getPath(new Haxelib("lime")) + "\\templates\\\\bin\\lime.sh", shDestPath);
}
catch (e:Dynamic)
{
copyFailure = true;
if (Log.verbose)
{
Log.warn("Failed to copy lime.sh alias to destination: " + shDestPath);
}
}
if (Log.verbose && copyFailure && usingDefaultHaxePath && !FileSystem.exists(haxePath))
{
Log.warn("Did you install Haxe to a custom location? Set the HAXEPATH environment variable, and run Lime setup again.");
}
catch (e:Dynamic) {}
}
else
{
@@ -859,32 +883,46 @@ class PlatformSetup
{
if (System.hostPlatform == MAC)
{
var aliasDestPath = "/usr/local/bin/lime";
try
{
System.runCommand("", "cp", [
"-f",
Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh",
"/usr/local/bin/lime"
aliasDestPath
], false);
System.runCommand("", "chmod", ["755", "/usr/local/bin/lime"], false);
System.runCommand("", "chmod", ["755", aliasDestPath], false);
installedCommand = true;
}
catch (e:Dynamic) {}
catch (e:Dynamic)
{
if (Log.verbose)
{
Log.warn("Failed to copy Lime alias to destination: " + aliasDestPath);
}
}
}
else
{
var aliasDestPath = "/usr/local/bin/lime";
try
{
System.runCommand("", "sudo", [
"cp",
"-f",
Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/lime.sh",
"/usr/local/bin/lime"
aliasDestPath
], false);
System.runCommand("", "sudo", ["chmod", "755", "/usr/local/bin/lime"], false);
System.runCommand("", "sudo", ["chmod", "755", aliasDestPath], false);
installedCommand = true;
}
catch (e:Dynamic) {}
catch (e:Dynamic)
{
if (Log.verbose)
{
Log.warn("Failed to copy Lime alias to destination: " + aliasDestPath);
}
}
}
}