mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
hack: check cached file (#8317)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const cacheManager = require('../cache-manager');
|
||||
const { fs, downloadFile, readText, readArrayBuffer, readJson, loadSubpackage, getUserDataPath } = window.fsUtils;
|
||||
const { fs, downloadFile, readText, readArrayBuffer, readJson, loadSubpackage, getUserDataPath, exists } = window.fsUtils;
|
||||
|
||||
const REGEX = /^https?:\/\/.*/;
|
||||
|
||||
@@ -135,7 +135,15 @@ function loadFont (url, options, onComplete) {
|
||||
onComplete(null, fontFamily || 'Arial');
|
||||
}
|
||||
|
||||
function doNothing (content, options, onComplete) { onComplete(null, content); }
|
||||
function doNothing (content, options, onComplete) {
|
||||
exists(content, (existence) => {
|
||||
if (existence) {
|
||||
onComplete(null, content);
|
||||
} else {
|
||||
onComplete(new Error(`file ${content} does not exist!`));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function downloadAsset (url, options, onComplete) {
|
||||
download(url, doNothing, options, options.onFileProgress, onComplete);
|
||||
|
||||
Reference in New Issue
Block a user