From 939f078dd89389c13ec0fe7886b2ccc9efab24c8 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Mon, 11 Mar 2013 00:53:22 +0100 Subject: Fixed / Improved commandline URL handling. - It's now possible to drag local files onto netsurf executable. - Added better resource file logging (THING passes strange CWD) --- atari/gui.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/atari/gui.c b/atari/gui.c index 9c04f7253..fe32a4a34 100644 --- a/atari/gui.c +++ b/atari/gui.c @@ -941,9 +941,13 @@ static void gui_init(int argc, char** argv) OBJECT * cursors; atari_find_resource(buf, "netsurf.rsc", "./res/netsurf.rsc"); - LOG(("%s ", (char*)&buf)); + LOG(("Using RSC file: %s ", (char*)&buf)); if (rsrc_load(buf)==0) { - die("Uable to open GEM Resource file!"); + + char msg[1024]; + + snprintf(msg, 1024, "Unable to open GEM Resource file (%s)!", buf); + die(msg); } wind_get_grect(0, WF_WORKXYWH, &desk_area); @@ -1029,6 +1033,8 @@ int main(int argc, char** argv) { char messages[PATH_MAX]; const char *addr; + char * file_url = NULL; + struct stat stat_buf; nsurl *url; nserror error; @@ -1060,11 +1066,14 @@ int main(int argc, char** argv) graf_mouse( ARROW , NULL); LOG(("Creating initial browser window...")); - if (nsoption_charp(homepage_url) != NULL) { - addr = nsoption_charp(homepage_url); - } else { - addr = NETSURF_HOMEPAGE; - } + addr = option_homepage_url; + if (strncmp(addr, "file://", 7)) { + if (stat(addr, &stat_buf) == 0) { + file_url = malloc(strlen(addr)+8); + sprintf(file_url, "file://%s", addr); + addr = file_url; + } + } /* create an initial browser window */ error = nsurl_create(addr, &url); @@ -1085,11 +1094,14 @@ int main(int argc, char** argv) } netsurf_exit(); - LOG(("ApplExit")); + + free(file_url); + #ifdef WITH_DBG_LOGFILE fclose(stdout); fclose(stderr); #endif + LOG(("exit_gem")); exit_gem(); return 0; -- cgit v1.2.3