summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2011-09-22 15:10:22 +0000
committerVincent Sanders <vince@netsurf-browser.org>2011-09-22 15:10:22 +0000
commit14db3f7c70de616d264b8dbe854e134bd1071bb4 (patch)
tree5e1a733229dd19150e50bdaeb39ce5a7feb1b81b /gtk
parentc98e37be1fbb88a0080c14216da393e53733c5fb (diff)
downloadnetsurf-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')
-rw-r--r--gtk/gui.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/gtk/gui.c b/gtk/gui.c
index abd02f1c2..94e68b84a 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -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);