summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2024-02-05 23:08:08 +0100
committerMorten Johan Sørvig <morten.sorvig@qt.io>2024-02-19 17:03:11 +0000
commit14a9a593a2a60ccedad92ef7fbeb6fb0501ac835 (patch)
tree1719551d55284b254ceb15961fea6f0e36b5c08e /src/plugins/platforms
parent573778de6041b155125dd7aaaf914795042ac464 (diff)
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 <lorn.potter@gmail.com> Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/wasm/qtloader.js16
1 files changed, 5 insertions, 11 deletions
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));