enable loading multiple manifests
This commit is contained in:
parent
d73b8bb02e
commit
e01cc817ef
@ -1,5 +1,6 @@
|
|||||||
package;
|
package;
|
||||||
|
|
||||||
|
#if sys
|
||||||
import haxe.io.Path;
|
import haxe.io.Path;
|
||||||
import lime.utils.AssetLibrary;
|
import lime.utils.AssetLibrary;
|
||||||
import lime.utils.AssetManifest;
|
import lime.utils.AssetManifest;
|
||||||
@ -15,13 +16,21 @@ import sys.FileSystem;
|
|||||||
public static function init(config:Dynamic):Void {
|
public static function init(config:Dynamic):Void {
|
||||||
rootPath = "";
|
rootPath = "";
|
||||||
|
|
||||||
#if sys
|
var manifestDirPath = Path.join(["manifest"]);
|
||||||
var manifestPath = Path.join(["manifest", "data.json"]);
|
var manifests = FileSystem.readDirectory(manifestDirPath);
|
||||||
|
for (manifest in manifests) {
|
||||||
|
if (StringTools.endsWith(manifest, ".json")) {
|
||||||
|
var manifestPath = Path.join([manifestDirPath, manifest]);
|
||||||
|
loadManifest(manifestPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadManifest(manifestPath) {
|
||||||
if (!FileSystem.exists(manifestPath)) {
|
if (!FileSystem.exists(manifestPath)) {
|
||||||
trace("Manifest file not found: " + manifestPath);
|
trace("Manifest file not found: " + manifestPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#end
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var manifest = AssetManifest.fromFile(manifestPath);
|
var manifest = AssetManifest.fromFile(manifestPath);
|
||||||
@ -38,3 +47,4 @@ import sys.FileSystem;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user