diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-09 18:11:32 -0400 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-09 18:11:32 -0400 |
commit | ee4a6fddc88829400d78f168305e44ad483268c0 (patch) | |
tree | 6f1032f40a7d22cfd87666a408112ac2e9c28c26 | |
parent | f36c188a94a64042b4d145fccec1ffe89d316fe4 (diff) |
look for structs in src/ dir as a fallback, like relooper
-rw-r--r-- | src/compiler.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler.js b/src/compiler.js index eadd6a88..2b7a218b 100644 --- a/src/compiler.js +++ b/src/compiler.js @@ -206,7 +206,12 @@ if (phase == 'pre') { if (VERBOSE) printErr('VERBOSE is on, this generates a lot of output and can slow down compilation'); // Load struct and define information. -var temp = JSON.parse(read(STRUCT_INFO)); +try { + var temp = JSON.parse(read(STRUCT_INFO)); +} catch(e) { + printErr('cannot load struct info at ' + STRUCT_INFO + ' : ' + e + ', trying in current dir'); + temp = JSON.parse(read('struct_info.compiled.json')); +} C_STRUCTS = temp.structs; C_DEFINES = temp.defines; |