From 393e1ef4ee4d5522ab28378eb88fef76a6eef8a0 Mon Sep 17 00:00:00 2001 From: Leon Krause Date: Tue, 27 Mar 2018 11:23:38 +0200 Subject: [PATCH] Allow custom path when using engine.js preloadFile() with URL (cherry picked from commit d373029382208226a55ddfc028a3261e0dc8279b) --- platform/javascript/engine.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js index afd912bf396..dab7104af81 100644 --- a/platform/javascript/engine.js +++ b/platform/javascript/engine.js @@ -88,7 +88,7 @@ }); } - this.preloadFile = function(pathOrBuffer, bufferFilename) { + this.preloadFile = function(pathOrBuffer, destPath) { if (pathOrBuffer instanceof ArrayBuffer) { pathOrBuffer = new Uint8Array(pathOrBuffer); @@ -97,14 +97,14 @@ } if (pathOrBuffer instanceof Uint8Array) { preloadedFiles.push({ - path: bufferFilename, + path: destPath, buffer: pathOrBuffer }); return Promise.resolve(); } else if (typeof pathOrBuffer === 'string') { return loadPromise(pathOrBuffer, preloadProgressTracker).then(function(xhr) { preloadedFiles.push({ - path: pathOrBuffer, + path: destPath || pathOrBuffer, buffer: xhr.response }); });