Export FS objects on FS.filesystems

Fixes #3690
This commit is contained in:
Kagami Hiiragi 2015-08-18 19:04:28 +03:00
Родитель 91d9a83504
Коммит 207be5c02b
2 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -29,6 +29,7 @@ mergeInto(LibraryManager.library, {
},
ErrnoError: null, // set during init
genericErrors: {},
filesystems: null,
handleFSError: function(e) {
if (!(e instanceof FS.ErrnoError)) throw e + ' : ' + stackTrace();
@ -1347,6 +1348,13 @@ mergeInto(LibraryManager.library, {
FS.createDefaultDirectories();
FS.createDefaultDevices();
FS.createSpecialDirectories();
FS.filesystems = {
'MEMFS': MEMFS,
'IDBFS': IDBFS,
'NODEFS': NODEFS,
'WORKERFS': WORKERFS,
};
},
init: function(input, output, error) {
assert(!FS.init.initialized, 'FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)');

Просмотреть файл

@ -7508,6 +7508,18 @@ int main(int argc, char **argv) {
self.emcc_args += ['--js-library', os.path.join(self.get_dir(), 'lib.js')]
self.do_run(open(os.path.join(self.get_dir(), 'main.cpp'), 'r').read(), 'able to run memprof')
def test_fs_dict(self):
open(self.in_dir('pre.js'), 'w').write('''
var Module = {};
Module['preRun'] = function() {
console.log(typeof FS.filesystems['MEMFS']);
console.log(typeof FS.filesystems['IDBFS']);
console.log(typeof FS.filesystems['NODEFS']);
};
''')
self.emcc_args += ['--pre-js', 'pre.js']
self.do_run('', 'object\nobject\nobject')
# Generate tests for everything
def make_run(fullname, name=-1, compiler=-1, embetter=0, quantum_size=0,
typed_arrays=0, emcc_args=None, env=None):