|
@@ -335,16 +335,12 @@ bool JSVM::ExecuteFile(File *file)
|
|
|
|
|
|
|
|
String source;
|
|
String source;
|
|
|
|
|
|
|
|
- file->ReadText(source);
|
|
|
|
|
- source.Append('\n');
|
|
|
|
|
|
|
+ duk_get_global_string(ctx_, "require");
|
|
|
|
|
+ duk_push_string(ctx_, "main");
|
|
|
|
|
|
|
|
- duk_push_string(ctx_, file->GetFullPath().CString());
|
|
|
|
|
- if (duk_eval_raw(ctx_, source.CString(), 0,
|
|
|
|
|
- DUK_COMPILE_EVAL | DUK_COMPILE_SAFE | DUK_COMPILE_NOSOURCE | DUK_COMPILE_STRLEN) != 0)
|
|
|
|
|
|
|
+ if (duk_pcall(ctx_, 1) != 0)
|
|
|
{
|
|
{
|
|
|
- SendJSErrorEvent(file->GetFullPath());
|
|
|
|
|
-
|
|
|
|
|
- duk_pop(ctx_);
|
|
|
|
|
|
|
+ SendJSErrorEvent();
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|