Improve assets cache break, allow disabling, or forcing a specific cache version
This commit is contained in:
@@ -1,13 +1,14 @@
|
|||||||
package lime.utils;
|
package lime.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import haxe.macro.Compiler;
|
||||||
|
import lime.media.AudioBuffer;
|
||||||
|
import lime.graphics.Image;
|
||||||
|
|
||||||
#if !(macro || commonjs)
|
#if !(macro || commonjs)
|
||||||
import lime._internal.macros.AssetsMacro;
|
import lime._internal.macros.AssetsMacro;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
import lime.media.AudioBuffer;
|
|
||||||
import lime.graphics.Image;
|
|
||||||
|
|
||||||
#if !lime_debug
|
#if !lime_debug
|
||||||
@:fileXml('tags="haxe,release"')
|
@:fileXml('tags="haxe,release"')
|
||||||
@:noDebug
|
@:noDebug
|
||||||
@@ -29,7 +30,14 @@ class AssetCache {
|
|||||||
audio = new Map<String, AudioBuffer> ();
|
audio = new Map<String, AudioBuffer> ();
|
||||||
font = new Map<String, Dynamic /*Font*/> ();
|
font = new Map<String, Dynamic /*Font*/> ();
|
||||||
image = new Map<String, Image> ();
|
image = new Map<String, Image> ();
|
||||||
version = #if (macro || commonjs) 0 #else AssetsMacro.cacheVersion () #end;
|
|
||||||
|
#if (macro || commonjs || lime_disable_assets_version)
|
||||||
|
version = 0;
|
||||||
|
#elseif lime_assets_version
|
||||||
|
version = Std.parseInt (Compiler.getDefine ("lime-assets-version"));
|
||||||
|
#else
|
||||||
|
version = AssetsMacro.cacheVersion ();
|
||||||
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -617,15 +617,14 @@ class Assets {
|
|||||||
@:noCompletion private static function __cacheBreak (path:String):String {
|
@:noCompletion private static function __cacheBreak (path:String):String {
|
||||||
|
|
||||||
#if web
|
#if web
|
||||||
if (path.indexOf ("?") > -1) {
|
if (cache.version > 0) {
|
||||||
|
if (path.indexOf ("?") > -1) {
|
||||||
path += "&" + cache.version;
|
path += "&" + cache.version;
|
||||||
|
} else {
|
||||||
} else {
|
path += "?" + cache.version;
|
||||||
|
}
|
||||||
path += "?" + cache.version;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
|||||||
Reference in New Issue
Block a user