diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2011-09-22 15:10:22 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2011-09-22 15:10:22 +0000 |
commit | 14db3f7c70de616d264b8dbe854e134bd1071bb4 (patch) | |
tree | 5e1a733229dd19150e50bdaeb39ce5a7feb1b81b /gtk/gui.c | |
parent | c98e37be1fbb88a0080c14216da393e53733c5fb (diff) | |
download | netsurf-14db3f7c70de616d264b8dbe854e134bd1071bb4.tar.gz netsurf-14db3f7c70de616d264b8dbe854e134bd1071bb4.tar.bz2 |
make resource path discovery robust when no resources can be found
svn path=/trunk/netsurf/; revision=12860
Diffstat (limited to 'gtk/gui.c')
-rw-r--r-- | gtk/gui.c | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -346,19 +346,23 @@ static void gui_init(int argc, char** argv, char **respath) /* check user options */ check_options(respath); + /* find the languages file */ + languages_file_location = filepath_find(respath, "languages"); + if ((languages_file_location == NULL) || + (strlen(languages_file_location) < 10)) { + die("Unable to find resources.\n"); + } + /* Obtain resources path location. * * Uses the directory the languages file was found in, - * previously the location of the glade files was used, - * however these may be translated which breaks things - * relying on res_dir_location. - */ - resource_filename = filepath_find(respath, "languages"); - resource_filename[strlen(resource_filename) - 9] = 0; - res_dir_location = resource_filename; - - /* languages file */ - languages_file_location = filepath_find(respath, "languages"); + * @todo find and slaughter all references to this! + */ + res_dir_location = calloc(1, strlen(languages_file_location) - 8); + memcpy(res_dir_location, + languages_file_location, + strlen(languages_file_location) - 9); + LOG(("Using '%s' for resource path", res_dir_location)); /* initialise the glade templates */ nsgtk_init_glade(respath); |