|
|
@ -94,13 +94,15 @@ JSValueRef function_read_file(JSContextRef ctx, JSObjectRef function, JSObjectRe
|
|
94
|
94
|
snprintf(full_path, 150, "%s/%s", "out", path);
|
|
95
|
95
|
|
|
96
|
96
|
char *contents = get_contents(full_path);
|
|
97
|
|
JSStringRef contents_str = JSStringCreateWithUTF8CString(contents);
|
|
98
|
|
free(contents);
|
|
|
97
|
if (contents != NULL) {
|
|
|
98
|
JSStringRef contents_str = JSStringCreateWithUTF8CString(contents);
|
|
|
99
|
free(contents);
|
|
99
|
100
|
|
|
100
|
|
JSValueRef res[2];
|
|
101
|
|
res[0] = JSValueMakeString(ctx, contents_str);
|
|
102
|
|
res[1] = JSValueMakeNumber(ctx, 0);
|
|
103
|
|
return JSObjectMakeArray(ctx, 2, res, NULL);
|
|
|
101
|
JSValueRef res[2];
|
|
|
102
|
res[0] = JSValueMakeString(ctx, contents_str);
|
|
|
103
|
res[1] = JSValueMakeNumber(ctx, 0);
|
|
|
104
|
return JSObjectMakeArray(ctx, 2, res, NULL);
|
|
|
105
|
}
|
|
104
|
106
|
}
|
|
105
|
107
|
|
|
106
|
108
|
return JSValueMakeNull(ctx);
|