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>
bb10
Morten Sørvig 2024-02-05 23:08:08 +01:00 committed by Morten Johan Sørvig
parent 573778de60
commit 14a9a593a2
1 changed files with 5 additions and 11 deletions

View File

@ -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));