Merge branch 'develop' into 8.2.0-Dev

This commit is contained in:
Joseph Cloutier
2024-04-13 03:09:20 -04:00
10 changed files with 320 additions and 387 deletions

View File

@@ -1,6 +1,23 @@
Changelog
=========
8.1.2 (03/13/2024)
------------------
* Fixed error handling when failing to get joystick information in html5.
* Fixed error handling when creating `openfl` alias on Linux.
* Fixed error handling when getting information about Haxelibs.
* Fixed error when loading fonts in HL.
* Fixed error when loading grouped music/sound assets.
* Fixed errors when building on Apple Silicon without Rosetta.
* Fixed assets not being loaded when using nested asset tags (e.g., `<assets path="assets"> <image path="MyImage.png" /> </assets>`).
* Fixed VC runtime potentially not being bundled into HL apps built on Windows.
* Fixed error in `AssetsMacro` when building with Haxe 4.3.4 or newer.
* Fixed crash on iOS during network operations.
* Updated howler.js to 2.2.3.
* Removed ARMv7 architecture from Android default architectures.
* Removed deprecated ARMv7 architecture from iOS default architectures.
8.1.1 (11/08/2023)
------------------

View File

@@ -7,14 +7,12 @@
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/zlib/" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/aes.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/aesni.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/aria.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/arc4.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/asn1parse.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/asn1write.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/base64.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/bignum.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/bignum_core.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/bignum_mod.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/bignum_mod_raw.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/blowfish.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/camellia.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ccm.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/chacha20.c" />
@@ -36,12 +34,12 @@
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/entropy_poll.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/error.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/gcm.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/hash_info.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/havege.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/hkdf.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/hmac_drbg.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/lmots.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/lms.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/md.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/md2.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/md4.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/md5.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/memory_buffer_alloc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/mps_reader.c" />
@@ -55,7 +53,6 @@
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/pk_wrap.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/pkcs12.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/pkcs5.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/pkcs7.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/pkparse.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/pkwrite.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/platform.c" />
@@ -69,7 +66,6 @@
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/psa_crypto_ecp.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/psa_crypto_hash.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/psa_crypto_mac.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/psa_crypto_pake.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/psa_crypto_rsa.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/psa_crypto_se.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/psa_crypto_slot_management.c" />
@@ -77,28 +73,27 @@
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/psa_its_file.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ripemd160.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/rsa.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/rsa_alt_helpers.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/rsa_internal.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/sha1.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/sha256.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/sha512.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_cache.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_ciphersuites.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_client.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_cli.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_cookie.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_debug_helpers_generated.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_msg.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_srv.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_ticket.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_tls.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_tls12_client.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_tls12_server.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_tls13_client.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_tls13_generic.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_tls13_keys.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/ssl_tls13_server.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/threading.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/timing.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/version.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/version_features.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/xtea.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/certs.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/pkcs11.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/x509.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/x509_create.c" />
<file name="${NATIVE_TOOLKIT_PATH}/mbedtls/library/x509_crl.c" />

View File

@@ -945,7 +945,7 @@ class Bytes
}
#elseif hl
#if !macro
@:autoBuild(lime._internal.macros.AssetsMacro.embedBytesHL()) // Enable @:bytes embed metadata
@:autoBuild(lime._internal.macros.AssetsMacro.embedBytes()) // Enable @:bytes embed metadata
#end
@:coreApi
class Bytes

View File

@@ -15,8 +15,11 @@ import sys.FileSystem;
class AssetsMacro
{
#if !macro
macro public static function cacheVersion() {}
#if (!macro || display)
macro public static function cacheVersion()
{
return macro 0;
}
#else
macro public static function cacheVersion()
{
@@ -26,77 +29,22 @@ class AssetsMacro
macro public static function embedBytes():Array<Field>
{
var fields = embedData(":file");
if (fields == null) return null;
if (fields != null)
var superCall = Context.defined("html5") ? macro super(bytes.b.buffer)
: Context.defined("hl") ? macro super(bytes.b, bytes.length)
: macro super(bytes.length, bytes.b);
var definition = macro class Temp
{
#if !display
var constructor = macro
public function new(?length:Int, ?bytesData:haxe.io.BytesData)
{
var bytes = haxe.Resource.getBytes(resourceName);
#if html5
super(bytes.b.buffer);
#elseif hl
super(bytes.b, bytes.length);
#else
super(bytes.length, bytes.b);
#end
$superCall;
}
};
var args = [
{name: "length", opt: true, type: macro:Int},
{name: "bytesData", opt: true, type: macro:haxe.io.BytesData}
];
fields.push(
{
name: "new",
access: [APublic],
kind: FFun(
{
args: args,
expr: constructor,
params: [],
ret: null
}),
pos: Context.currentPos()
});
#end
}
return fields;
}
macro public static function embedBytesHL():Array<Field>
{
var fields = embedData(":file");
if (fields != null)
{
#if !display
var constructor = macro
{
var bytes = haxe.Resource.getBytes(resourceName);
super(bytes.b, bytes.length);
};
var args = [
{name: "length", opt: true, type: macro:Int},
{name: "bytesData", opt: true, type: macro:haxe.io.BytesData}
];
fields.push(
{
name: "new",
access: [APublic],
kind: FFun(
{
args: args,
expr: constructor,
params: [],
ret: null
}),
pos: Context.currentPos()
});
#end
}
fields.push(definition.fields[0]);
return fields;
}
@@ -104,67 +52,45 @@ class AssetsMacro
macro public static function embedByteArray():Array<Field>
{
var fields = embedData(":file");
if (fields == null) return null;
if (fields != null)
var definition = macro class Temp
{
#if !display
var constructor = macro
public function new(?length:Int = 0)
{
super();
var bytes = haxe.Resource.getBytes(resourceName);
__fromBytes(bytes);
}
};
var args = [
{
name: "length",
opt: true,
type: macro:Int,
value: macro 0
}
];
fields.push(
{
name: "new",
access: [APublic],
kind: FFun(
{
args: args,
expr: constructor,
params: [],
ret: null
}),
pos: Context.currentPos()
});
#end
}
fields.push(definition.fields[0]);
return fields;
}
private static function embedData(metaName:String, encode:Bool = false):Array<Field>
{
#if !display
if (Context.defined("display")) return null;
var classType = Context.getLocalClass().get();
var metaData = classType.meta.get();
var metaData = classType.meta;
var position = Context.currentPos();
var fields = Context.getBuildFields();
for (meta in metaData)
{
if (meta.name == metaName)
{
if (meta.params.length > 0)
for (meta in metaData.extract(metaName))
{
if (meta.params.length == 0) continue;
switch (meta.params[0].expr)
{
case EConst(CString("" | null)):
return null;
case EConst(CString(filePath)):
var path = filePath;
if (path == "") return null;
if (path == null) return null;
if (!FileSystem.exists(filePath))
{
path = Context.resolvePath(filePath);
@@ -200,14 +126,12 @@ class AssetsMacro
resourceType = "image/gif";
}
var fieldValue = {pos: position, expr: EConst(CString(resourceType))};
fields.push(
var definition = macro class Temp
{
kind: FVar(macro:String, fieldValue),
name: "resourceType",
access: [APrivate, AStatic],
pos: position
});
private static inline var resourceType:String = $v{ resourceType };
};
fields.push(definition.fields[0]);
var base64 = Base64.encode(bytes);
Context.addResource(resourceName, Bytes.ofString(base64));
@@ -217,29 +141,26 @@ class AssetsMacro
Context.addResource(resourceName, bytes);
}
var fieldValue = {pos: position, expr: EConst(CString(resourceName))};
fields.push(
var definition = macro class Temp
{
kind: FVar(macro:String, fieldValue),
name: "resourceName",
access: [APrivate, AStatic],
pos: position
});
private static inline var resourceName:String = $v{ resourceName };
};
fields.push(definition.fields[0]);
return fields;
default:
}
}
}
}
#end
return null;
}
macro public static function embedFont():Array<Field>
{
if (Context.defined("display")) return Context.getBuildFields();
var fields = null;
var classType = Context.getLocalClass().get();
@@ -250,7 +171,6 @@ class AssetsMacro
var path = "";
var glyphs = "32-255";
#if !display
for (meta in metaData)
{
if (meta.name == ":font")
@@ -275,10 +195,11 @@ class AssetsMacro
if (path != null && path != "")
{
#if html5
if (Context.defined("html5"))
{
Sys.command("haxelib", ["run", "lime", "generate", "-font-hash", sys.FileSystem.fullPath(path)]);
path += ".hash";
#end
}
var bytes = File.getBytes(path);
var resourceName = "LIME_font_" + (classType.pack.length > 0 ? classType.pack.join("_") + "_" : "") + classType.name;
@@ -294,57 +215,44 @@ class AssetsMacro
}
}
var fieldValue = {pos: position, expr: EConst(CString(resourceName))};
fields.push(
var definition = macro class Temp
{
kind: FVar(macro:String, fieldValue),
name: "resourceName",
access: [APublic, AStatic],
pos: position
});
private static var resourceName:String = $v{ resourceName };
var constructor = macro
public function new()
{
super();
__fromBytes(haxe.Resource.getBytes(resourceName));
}
};
fields.push(
{
name: "new",
access: [APublic],
kind: FFun(
{
args: [],
expr: constructor,
params: [],
ret: null
}),
pos: Context.currentPos()
});
fields.push(definition.fields[0]);
fields.push(definition.fields[1]);
return fields;
}
#end
return fields;
}
macro public static function embedImage():Array<Field>
{
#if html5
var fields = embedData(":image", true);
#else
var fields = embedData(":image");
#end
var fields = embedData(":image", Context.defined("html5"));
if (fields == null) return null;
if (fields != null)
var definition:TypeDefinition;
if (Context.defined("html5"))
{
#if !display
var constructor = macro
definition = macro class Temp
{
public static var preload:js.html.Image;
public function new(?buffer:lime.graphics.ImageBuffer,
?offsetX:Int, ?offsetY:Int, ?width:Int, ?height:Int,
?color:Null<Int>, ?type:lime.graphics.ImageType,
?onload:Dynamic = true)
{
#if html5
super();
if (preload != null)
@@ -371,91 +279,27 @@ class AssetsMacro
}
});
}
#else
}
};
}
else
{
definition = macro class Temp
{
public function new(?buffer:lime.graphics.ImageBuffer,
?offsetX:Int, ?offsetY:Int, ?width:Int, ?height:Int,
?color:Null<Int>, ?type:lime.graphics.ImageType)
{
super();
__fromBytes(haxe.Resource.getBytes(resourceName), null);
#end
};
var args = [
{
name: "buffer",
opt: true,
type: macro:lime.graphics.ImageBuffer,
value: null
},
{
name: "offsetX",
opt: true,
type: macro:Int,
value: null
},
{
name: "offsetY",
opt: true,
type: macro:Int,
value: null
},
{
name: "width",
opt: true,
type: macro:Int,
value: null
},
{
name: "height",
opt: true,
type: macro:Int,
value: null
},
{
name: "color",
opt: true,
type: macro:Null<Int>,
value: null
},
{
name: "type",
opt: true,
type: macro:lime.graphics.ImageType,
value: null
}
];
};
}
#if html5
args.push(
for (field in definition.fields)
{
name: "onload",
opt: true,
type: macro:Dynamic,
value: null
});
fields.push(
{
kind: FVar(macro:js.html.Image, null),
name: "preload",
doc: null,
meta: [],
access: [APublic, AStatic],
pos: Context.currentPos()
});
#end
fields.push(
{
name: "new",
access: [APublic],
kind: FFun(
{
args: args,
expr: constructor,
params: [],
ret: null
}),
pos: Context.currentPos()
});
#end
fields.push(field);
}
return fields;
@@ -464,54 +308,24 @@ class AssetsMacro
macro public static function embedSound():Array<Field>
{
var fields = embedData(":sound");
// CFFILoader.h(248) : NOT Implemented:api_buffer_data
if (fields == null || Context.defined("html5") || !Context.defined("openfl"))
return null;
if (fields != null)
var definition = macro class Temp
{
#if (openfl && !html5 && !display) // CFFILoader.h(248) : NOT Implemented:api_buffer_data
var constructor = macro
public function new(?stream:openfl.net.URLRequest,
?context:openfl.media.SoundLoaderContext,
?forcePlayAsMusic:Bool = false)
{
super();
var byteArray = openfl.utils.ByteArray.fromBytes(haxe.Resource.getBytes(resourceName));
loadCompressedDataFromByteArray(byteArray, byteArray.length, forcePlayAsMusic);
}
};
var args = [
{
name: "stream",
opt: true,
type: macro:openfl.net.URLRequest,
value: null
},
{
name: "context",
opt: true,
type: macro:openfl.media.SoundLoaderContext,
value: null
},
{
name: "forcePlayAsMusic",
opt: true,
type: macro:Bool,
value: macro false
}
];
fields.push(
{
name: "new",
access: [APublic],
kind: FFun(
{
args: args,
expr: constructor,
params: [],
ret: null
}),
pos: Context.currentPos()
});
#end
}
fields.push(definition.fields[0]);
return fields;
}

View File

@@ -510,21 +510,18 @@ class ProjectXMLParser extends HXProject
}
}
var id = "";
var asset = new Asset(path + childPath, targetPath + childTargetPath, childType, childEmbed);
asset.library = childLibrary;
if (childElement.has.id)
{
id = substitute(childElement.att.id);
asset.id = substitute(childElement.att.id);
}
else if (childElement.has.name)
{
id = substitute(childElement.att.name);
asset.id = substitute(childElement.att.name);
}
var asset = new Asset(path + childPath, targetPath + childTargetPath, childType, childEmbed);
asset.library = childLibrary;
asset.id = id;
if (childGlyphs != null)
{
asset.glyphs = childGlyphs;

View File

@@ -223,7 +223,7 @@ class FileDialog
**/
public function open(filter:String = null, defaultPath:String = null, title:String = null):Bool
{
#if desktop
#if (desktop && sys)
var worker = new ThreadPool();
worker.onComplete.add(function(path:String)
@@ -286,7 +286,7 @@ class FileDialog
return false;
}
#if desktop
#if (desktop && sys)
var worker = new ThreadPool();
worker.onComplete.add(function(path:String)

View File

@@ -2,14 +2,29 @@ package lime.utils;
import haxe.ds.ObjectMap;
/**
A generic object pool for reusing objects.
**/
#if !lime_debug
@:fileXml('tags="haxe,release"')
@:noDebug
#end
#if !js @:generic #end class ObjectPool<T>
{
/**
The number of active objects in the pool.
**/
public var activeObjects(default, null):Int;
/**
The number of inactive objects in the pool.
**/
public var inactiveObjects(default, null):Int;
/**
The total size of the object pool (both active and inactive objects).
**/
public var size(get, set):Null<Int>;
@:noCompletion private var __inactiveObject0:T;
@@ -18,6 +33,13 @@ import haxe.ds.ObjectMap;
@:noCompletion private var __pool:Map<T, Bool>;
@:noCompletion private var __size:Null<Int>;
/**
Creates a new ObjectPool instance.
@param create A function that creates a new instance of type T.
@param clean A function that cleans up an instance of type T before it is reused.
@param size The maximum size of the object pool.
**/
public function new(create:Void->T = null, clean:T->Void = null, size:Null<Int> = null)
{
__pool = cast new ObjectMap();
@@ -42,10 +64,14 @@ import haxe.ds.ObjectMap;
this.size = size;
}
}
/**
Adds an object to the object pool.
@param object The object to add to the pool.
**/
public function add(object:T):Void
{
if (!__pool.exists(object))
if (object != null && !__pool.exists(object))
{
__pool.set(object, false);
clean(object);
@@ -53,8 +79,18 @@ import haxe.ds.ObjectMap;
}
}
/**
Dynamic function.
Cleans up an object before returning it to the pool.
@param object The object to clean up.
**/
public dynamic function clean(object:T):Void {}
/**
Clears the object pool, removing all objects.
**/
public function clear():Void
{
__pool = cast new ObjectMap();
@@ -67,11 +103,21 @@ import haxe.ds.ObjectMap;
__inactiveObjectList.clear();
}
/**
Dynamic function.
Creates a new Object.
**/
public dynamic function create():T
{
return null;
}
/**
Creates a new object and adds it to the pool, or returns an existing inactive object from the pool.
@return The object retrieved from the pool, or null if the pool is full and no new objects can be created.
**/
public function get():T
{
var object = null;
@@ -94,10 +140,15 @@ import haxe.ds.ObjectMap;
return object;
}
/**
Releases an active object back into the pool.
@param object The object to release.
**/
public function release(object:T):Void
{
#if debug
if (!__pool.exists(object))
if (object == null || !__pool.exists(object))
{
Log.error("Object is not a member of the pool");
}
@@ -120,9 +171,14 @@ import haxe.ds.ObjectMap;
}
}
/**
Removes an object from the pool.
@param object The object to remove from the pool.
**/
public function remove(object:T):Void
{
if (__pool.exists(object))
if (object != null && __pool.exists(object))
{
__pool.remove(object);

View File

@@ -238,7 +238,23 @@ class WindowsPlatform extends PlatformTarget
{
System.runCommand("", "haxe", [hxml]);
var msBuildPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe";
// start by finding visual studio
var programFilesX86 = Sys.getEnv("ProgramFiles(x86)");
var vswhereCommand = programFilesX86 + "\\Microsoft Visual Studio\\Installer\\vswhere.exe";
var vswhereOutput = System.runProcess("", vswhereCommand, ["-latest", "-products", "*", "-requires", "Microsoft.Component.MSBuild", "-property", "installationPath"]);
var visualStudioPath = StringTools.trim(vswhereOutput);
// then, find MSBuild inside visual studio
var msBuildPath = visualStudioPath + "\\MSBuild\\Current\\Bin\\MSBuild.exe";
if (!FileSystem.exists(msBuildPath))
{
// fallback for VS 2017, which didn't use Current
msBuildPath = visualStudioPath + "\\MSBuild\\15.0\\Bin\\MSBuild.exe";
if (!FileSystem.exists(msBuildPath))
{
Log.error("MSBuild not found");
return;
}
}
var args = [
Path.tryFullPath(targetDirectory + "/source/" + project.app.file + ".jsproj"),
"/p:Configuration=Release"

View File

@@ -826,25 +826,49 @@ class PlatformSetup
return;
}
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
{
@@ -869,32 +893,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);
}
}
}
}