aboutsummaryrefslogtreecommitdiff
path: root/src/compiler.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler.js')
-rw-r--r--src/compiler.js7
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;