diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-05-09 11:36:14 +0200 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-05-09 11:36:14 +0200 |
commit | 697ef457e1b0eabd3aa9fb2332a5d04478b39603 (patch) | |
tree | 4d93ec7e3d1cc698a5c54de9785d688bf510ed15 /src/loadlib.js | |
parent | 3e439ed653093e6e124a4997f64053164f1043b8 (diff) | |
download | fengari-697ef457e1b0eabd3aa9fb2332a5d04478b39603.tar.gz fengari-697ef457e1b0eabd3aa9fb2332a5d04478b39603.tar.bz2 fengari-697ef457e1b0eabd3aa9fb2332a5d04478b39603.zip |
Webpack (single bundle for now)
Diffstat (limited to 'src/loadlib.js')
-rw-r--r-- | src/loadlib.js | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/loadlib.js b/src/loadlib.js index e7b1680..c2e867a 100644 --- a/src/loadlib.js +++ b/src/loadlib.js @@ -79,28 +79,23 @@ let readable = function(filename) { return false; }; // Only with Node -if (typeof require === "function") { +if (!WEB) { - let fs = false; - try { - fs = require('fs'); - } catch (e) {} + const fs = require('fs'); - if (fs) { - readable = function(filename) { - let fd = false; + readable = function(filename) { + let fd = false; - try { - fd = fs.openSync(lua.to_jsstring(filename), 'r'); - } catch (e) { - return false; - } + try { + fd = fs.openSync(lua.to_jsstring(filename), 'r'); + } catch (e) { + return false; + } - fs.closeSync(fd); + fs.closeSync(fd); - return true; - }; - } + return true; + }; } |