From f093965dfc07935323b8a9244a591d84788b497c Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 21 Sep 2008 22:16:18 -0400 Subject: 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. --- src/textadept.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/textadept.c') 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 -- cgit v1.2.3