only cache AsyncEmbeddedScript with kissCache

This commit is contained in:
2023-07-20 08:40:57 -06:00
parent 462d5d64a8
commit c3cfcd4e06

View File

@@ -246,12 +246,14 @@ class AsyncEmbeddedScript {
var hscriptInstructions:Map<String,String> = [];
var cache:Map<String,String> = [];
#if kissCache
var cacheFile = scriptFile.withoutExtension().withoutDirectory() + ".cache.json";
if (sys.FileSystem.exists(cacheFile)) {
var cacheJson:haxe.DynamicAccess<String> = haxe.Json.parse(sys.io.File.getContent(cacheFile));
for (key => value in cacheJson)
cache[key] = value;
}
#end
var hscriptInstructionFile = scriptFile.withoutExtension().withoutDirectory() + ".hscript.json";
@@ -379,8 +381,10 @@ class AsyncEmbeddedScript {
})
});
#if kissCache
sys.io.File.saveContent(cacheFile, haxe.Json.stringify(cache));
sys.io.File.saveContent(hscriptInstructionFile, haxe.Json.stringify(hscriptInstructions));
#end
return classFields;
}