Asset manifest fix on Android
This commit is contained in:
@@ -721,7 +721,7 @@ class AssetLibrary
|
|||||||
|
|
||||||
if (Reflect.hasField(asset, "path"))
|
if (Reflect.hasField(asset, "path"))
|
||||||
{
|
{
|
||||||
paths.set(id, __cacheBreak(basePath + Reflect.field(asset, "path")));
|
paths.set(id, __cacheBreak(__resolvePath(basePath + Reflect.field(asset, "path"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Reflect.hasField(asset, "pathGroup"))
|
if (Reflect.hasField(asset, "pathGroup"))
|
||||||
@@ -730,7 +730,7 @@ class AssetLibrary
|
|||||||
|
|
||||||
for (i in 0...pathGroup.length)
|
for (i in 0...pathGroup.length)
|
||||||
{
|
{
|
||||||
pathGroup[i] = __cacheBreak(basePath + pathGroup[i]);
|
pathGroup[i] = __cacheBreak(__resolvePath(basePath + pathGroup[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
pathGroups.set(id, pathGroup);
|
pathGroups.set(id, pathGroup);
|
||||||
@@ -772,6 +772,47 @@ class AssetLibrary
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@:noCompletion private function __resolvePath(path:String):String
|
||||||
|
{
|
||||||
|
path = StringTools.replace(path, "\\", "/");
|
||||||
|
path = StringTools.replace(path, "//", "/");
|
||||||
|
|
||||||
|
if (path.indexOf("./") > -1)
|
||||||
|
{
|
||||||
|
var split = path.split("/");
|
||||||
|
var newPath = [];
|
||||||
|
|
||||||
|
for (i in 0...split.length)
|
||||||
|
{
|
||||||
|
if (split[i] == "..")
|
||||||
|
{
|
||||||
|
if (i == 0 || newPath[i - 1] == "..")
|
||||||
|
{
|
||||||
|
newPath.push("..");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newPath.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (split[i] == ".")
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
newPath.push(".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newPath.push(split[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
path = newPath.join("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
// Event Handlers
|
// Event Handlers
|
||||||
@:noCompletion private function loadAudioBuffer_onComplete(id:String, audioBuffer:AudioBuffer):Void
|
@:noCompletion private function loadAudioBuffer_onComplete(id:String, audioBuffer:AudioBuffer):Void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ class AssetManifest
|
|||||||
basePath = path;
|
basePath = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringTools.replace(basePath, "\\", "/");
|
basePath = StringTools.replace(basePath, "\\", "/");
|
||||||
|
|
||||||
while (StringTools.endsWith(basePath, "/"))
|
while (StringTools.endsWith(basePath, "/"))
|
||||||
{
|
{
|
||||||
@@ -200,7 +200,7 @@ class AssetManifest
|
|||||||
rootPath = path;
|
rootPath = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringTools.replace(rootPath, "\\", "/");
|
rootPath = StringTools.replace(rootPath, "\\", "/");
|
||||||
|
|
||||||
while (StringTools.endsWith(rootPath, "/"))
|
while (StringTools.endsWith(rootPath, "/"))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user