Fix regression in ByteArray.readFile on Android
This commit is contained in:
@@ -328,11 +328,11 @@ class ByteArray #if !js extends Bytes implements ArrayAccess<Int> implements IDa
|
||||
|
||||
public static function readFile (path:String):ByteArray {
|
||||
|
||||
#if html5
|
||||
return null;
|
||||
#else
|
||||
return ByteArray.fromBytes (File.getBytes (path));
|
||||
#if !html5
|
||||
var data = lime_bytes_read_file (path);
|
||||
if (data != null) return ByteArray.fromBytes (@:privateAccess new Bytes (data.length, data.b));
|
||||
#end
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@@ -1093,6 +1093,7 @@ class ByteArray #if !js extends Bytes implements ArrayAccess<Int> implements IDa
|
||||
|
||||
|
||||
private static var lime_bytes_get_data_pointer = System.load ("lime", "lime_bytes_get_data_pointer", 1);
|
||||
private static var lime_bytes_read_file = System.load ("lime", "lime_bytes_read_file", 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,14 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
value lime_bytes_read_file (value path) {
|
||||
|
||||
Bytes data = Bytes (val_os_string (path));
|
||||
return data.Value ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void lime_font_destroy (value handle) {
|
||||
|
||||
Font *font = (Font*)(intptr_t)val_float (handle);
|
||||
@@ -1104,6 +1112,7 @@ namespace lime {
|
||||
DEFINE_PRIM (lime_application_update, 1);
|
||||
DEFINE_PRIM (lime_audio_load, 1);
|
||||
DEFINE_PRIM (lime_bytes_get_data_pointer, 1);
|
||||
DEFINE_PRIM (lime_bytes_read_file, 1);
|
||||
DEFINE_PRIM (lime_font_get_ascender, 1);
|
||||
DEFINE_PRIM (lime_font_get_descender, 1);
|
||||
DEFINE_PRIM (lime_font_get_family_name, 1);
|
||||
|
||||
Reference in New Issue
Block a user