Pārlūkot izejas kodu

[python] cleanup haxe.Resource (see #4400), remove `embed_resources` check for now as it doesn't seem to be implemented in the compiler anyway (cc @frabbit)

Dan Korostelev 10 gadi atpakaļ
vecāks
revīzija
7fd122fbef
1 mainītis faili ar 7 papildinājumiem un 20 dzēšanām
  1. 7 20
      std/python/_std/haxe/Resource.hx

+ 7 - 20
std/python/_std/haxe/Resource.hx

@@ -38,29 +38,16 @@ import haxe.io.BytesData;
 	}
 
 	public static function getString( name : String ) : String {
-        #if embed_resources
-		for (k in getContent().keys().iter()) {
-			if (k == name) {
-				var b : haxe.io.Bytes = haxe.crypto.Base64.decode(getContent().get(k, null));
-				return b.toString();
-			}
-		}
+		var bytes = getBytes(name);
+		if (bytes != null)
+			return bytes.toString();
 		return null;
-        #else
-        return getContent().hasKey(name) ? Bytes.ofData(getContent().get(name, null)).toString() : null;
-        #end
 	}
 
 	public static function getBytes( name : String ) : haxe.io.Bytes {
-        #if embed_resources
-		for( k in getContent().keys().iter() )
-			if( k == name ) {
-				var b : haxe.io.Bytes = haxe.crypto.Base64.decode(getContent().get(k, null));
-				return b;
-
-			}
-        #else
-        return Bytes.ofData(getContent().get(name,null));
-        #end
+		var data = getContent().get(name, null);
+		if (data == null)
+			return null;
+		return Bytes.ofData(data);
 	}
 }