aboutsummaryrefslogtreecommitdiff
path: root/src/textadept.c
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2008-09-21 22:16:18 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2008-09-21 22:16:18 -0400
commitf093965dfc07935323b8a9244a591d84788b497c (patch)
tree37e9be66f26d79f95f286566fc3ceb7b6b398620 /src/textadept.c
parentfdb720e8d0b5adf4fd9269ee9e4381dc0aebdb39 (diff)
downloadtextadept-f093965dfc07935323b8a9244a591d84788b497c.tar.gz
textadept-f093965dfc07935323b8a9244a591d84788b497c.zip
Textadept gracefully exits when errors occur in core/init.lua.
Originally the error message was displayed in Textadept, but any attempts to close the program would fail because core/init.lua wasn't properly loaded. Errors from 'l_load_script' are displayed in a dialog box now.
Diffstat (limited to 'src/textadept.c')
-rw-r--r--src/textadept.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/textadept.c b/src/textadept.c
index 4d639ab6..9aaeccd6 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -2,11 +2,6 @@
#include "textadept.h"
-#ifdef WIN32
-#include "Windows.h"
-#define strcasecmp _stricmp
-#endif
-
#define gbool gboolean
#define signal(o, s, c) g_signal_connect(G_OBJECT(o), s, G_CALLBACK(c), 0)
@@ -71,11 +66,13 @@ static void button_clicked(GtkWidget *button, gpointer);
*/
int main(int argc, char **argv) {
gtk_init(&argc, &argv);
- l_init(argc, argv, false);
- create_ui();
- l_load_script("init.lua");
- gtk_main();
- return 0;
+ if (l_init(argc, argv, false)) {
+ create_ui();
+ l_load_script("init.lua");
+ gtk_main();
+ return 0;
+ } else if (lua) lua_close(lua);
+ return 1;
}
#ifdef WIN32