From 14a9a593a2a60ccedad92ef7fbeb6fb0501ac835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Mon, 5 Feb 2024 23:08:08 +0100 Subject: wasm: fix copy/paste error in FS export check The check for environment variables was copied over from the ENV export test, but is not relevant for FS. Remove it and then inline at the call site since this this is now only three lines of code. Change-Id: If377401154ff1ef6c71a5f1ebeb6459118d4d395 Reviewed-by: Lorn Potter Reviewed-by: Even Oscar Andersen --- src/plugins/platforms/wasm/qtloader.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/wasm/qtloader.js b/src/plugins/platforms/wasm/qtloader.js index 25e4707c56..89944d6dd9 100644 --- a/src/plugins/platforms/wasm/qtloader.js +++ b/src/plugins/platforms/wasm/qtloader.js @@ -80,16 +80,6 @@ async function qtLoad(config) throw new Error('ENV must be exported if environment variables are passed'); }; - const throwIfFsUsedButNotExported = (instance, config) => - { - const environment = config.environment; - if (!environment || Object.keys(environment).length === 0) - return; - const isFsExported = typeof instance.FS === 'object'; - if (!isFsExported) - throw new Error('FS must be exported if preload is used'); - }; - if (typeof config !== 'object') throw new Error('config is required, expected an object'); if (typeof config.qt !== 'object') @@ -155,7 +145,11 @@ async function qtLoad(config) } } } - throwIfFsUsedButNotExported(instance, config); + + const isFsExported = typeof instance.FS === 'object'; + if (!isFsExported) + throw new Error('FS must be exported if preload is used'); + for ({destination, data} of self.preloadData) { makeDirs(instance.FS, destination); instance.FS.writeFile(destination, new Uint8Array(data)); -- cgit v1.2.3