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