diff options
-rw-r--r-- | src/library.js | 4 | ||||
-rw-r--r-- | src/postamble.js | 5 | ||||
-rw-r--r-- | tests/runner.py | 4 |
3 files changed, 3 insertions, 10 deletions
diff --git a/src/library.js b/src/library.js index 3c596ea1..bdaf3e00 100644 --- a/src/library.js +++ b/src/library.js @@ -26,7 +26,7 @@ LibraryManager.library = { _impure_ptr: 0, $FS__deps: ['$ERRNO_CODES', '__setErrNo', 'stdin', 'stdout', 'stderr', '_impure_ptr'], - $FS__postset: 'FS.init(); __ATEXIT__.push({ func: function() { FS.quit() } });', + $FS__postset: '__ATINIT__.push({ func: function() { FS.ignorePermissions = false } }); FS.init(); __ATEXIT__.push({ func: function() { FS.quit() } });', $FS: { // The path to the current folder. currentPath: '/', @@ -39,6 +39,8 @@ LibraryManager.library = { streams: [null], // Whether we are currently ignoring permissions. Useful when preparing the // filesystem and creating files inside read-only folders. + // This is set to false when the runtime is initialized, allowing you + // to modify the filesystem freely before run() is called. ignorePermissions: true, // Converts any path to an absolute path. Resolves embedded "." and ".." // parts. diff --git a/src/postamble.js b/src/postamble.js index 27242363..ada13016 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -45,11 +45,6 @@ Module['run'] = run; // {{PRE_RUN_ADDITIONS}} -// In a hackish way, we disable permissions until now, so setup code works, but enable them for runtime so compile code works with permissions -try { - FS.ignorePermissions = false; -} catch(e){} - #if INVOKE_RUN #else Module['noInitialRun'] = true; diff --git a/tests/runner.py b/tests/runner.py index bf8cc3d5..1bd07564 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -4085,9 +4085,7 @@ def process(filename): src.write(\'\'\' FS.init(); FS.root.write = true; - FS.ignorePermissions = true; // /dev is read-only FS.createPath('/', 'dev/shm/tmp', true, true); - FS.ignorePermissions = false; FS.currentPath = '/dev/shm/tmp'; run(); \'\'\') @@ -4167,10 +4165,8 @@ def process(filename): src = open(filename, 'a') src.write( \'\'\' - FS.ignorePermissions = true; FS.createDataFile('/', 'paper.pdf', eval(read('paper.pdf.js')), true, false); FS.root.write = true; - FS.ignorePermissions = false; run(); print("Data: " + JSON.stringify(FS.root.contents['filename-1.ppm'].contents.map(function(x) { return unSign(x, 8) }))); \'\'\' |