diff options
Diffstat (limited to 'hardinfo2')
| -rw-r--r-- | hardinfo2/hardinfo.c | 29 | ||||
| -rw-r--r-- | hardinfo2/util.c | 13 | 
2 files changed, 26 insertions, 16 deletions
diff --git a/hardinfo2/hardinfo.c b/hardinfo2/hardinfo.c index 872dfa51..85bd2a91 100644 --- a/hardinfo2/hardinfo.c +++ b/hardinfo2/hardinfo.c @@ -37,10 +37,6 @@ int main(int argc, char **argv)      int exit_code = 0;      GSList *modules; -    setlocale(LC_ALL, ""); -    bindtextdomain("hardinfo2", LOCALEDIR); -    textdomain("hardinfo2"); -      DEBUG("Hardinfo2 version " VERSION ". Debug version.");  #if GLIB_CHECK_VERSION(2,32,5) @@ -52,6 +48,20 @@ int main(int argc, char **argv)      /* parse all command line parameters */      parameters_init(&argc, &argv, ¶ms); +    /* initialize the binreloc library, so we can load program data */ +#if(ENABLE_BINRELOC) +    if (!binreloc_init(FALSE)) +         g_error("Failed to find runtime data. PREFIX=%s, LIB=%s, LOCALE=%s\n",PREFIX,LIBPREFIX,LOCALEDIR); +#else +    params.path_data=g_strdup(PREFIX); +    params.path_lib=g_strdup(LIBPREFIX); +    params.path_locale=g_strdup(LOCALEDIR); +#endif + +    setlocale(LC_ALL, ""); +    bindtextdomain("hardinfo2", params.path_locale); +    textdomain("hardinfo2"); +      /* show version information and quit */      if (params.show_version) {          g_print("Hardinfo2 version " VERSION "\n"); @@ -64,22 +74,15 @@ int main(int argc, char **argv)  		"  BinReloc enabled:  %s\n"  		"  Data prefix:       %s\n"  		"  Library prefix:    %s\n" +		"  Locale prefix :    %s\n"  		"  Compiled for:      %s\n"),  		RELEASE==1 ? "Yes (" VERSION ")" : (RELEASE==0?"No (" VERSION ")":"Debug (" VERSION ")"), ARCH,  		HARDINFO2_LIBSOUP3 ? _("3.0") : "2.4",  		ENABLE_BINRELOC ? _("Yes") : _("No"), -		PREFIX, LIBPREFIX, PLATFORM); - +		params.path_data, params.path_lib, params.path_locale, PLATFORM);          return 0;      } -    /* initialize the binreloc library, so we can load program data */ -    if (!binreloc_init(FALSE)) -	g_error(_("Failed to find runtime data.\n\n" -		"\342\200\242 Is HardInfo2 correctly installed?\n" -		"\342\200\242 See if %s and %s exists and you have read permission."), -		PREFIX, LIBPREFIX); -      if (!params.create_report && !params.run_benchmark) {          /* we only try to open the UI if the user didn't ask for a report. */          params.gui_running = ui_init(&argc, &argv); diff --git a/hardinfo2/util.c b/hardinfo2/util.c index 9fbe6340..aef253d4 100644 --- a/hardinfo2/util.c +++ b/hardinfo2/util.c @@ -292,6 +292,7 @@ gboolean binreloc_init(gboolean try_hardcoded)  	/* We were asked to try hardcoded paths or BinReloc failed to initialize. */  	params.path_data = g_strdup(PREFIX);  	params.path_lib = g_strdup(LIBPREFIX); +	params.path_locale = g_strdup(LOCALEDIR);  	if (error) {  	    g_error_free(error); @@ -311,11 +312,16 @@ gboolean binreloc_init(gboolean try_hardcoded)  	tmp = gbr_find_lib_dir(PREFIX);  	params.path_lib = g_build_filename(tmp, "hardinfo2", NULL);  	g_free(tmp); + +	tmp = gbr_find_locale_dir(PREFIX); +	params.path_locale = g_build_filename(tmp, NULL); +	g_free(tmp);      }      DEBUG("searching for runtime data on these locations:"); -    DEBUG("  lib: %s", params.path_lib); -    DEBUG(" data: %s", params.path_data); +    DEBUG("   lib: %s", params.path_lib); +    DEBUG("  data: %s", params.path_data); +    DEBUG("locale: %s", params.path_locale);      /* Try to see if the benchmark test data file isn't missing. This isn't the         definitive test, but it should do okay for most situations. */ @@ -325,9 +331,10 @@ gboolean binreloc_init(gboolean try_hardcoded)  	g_free(params.path_data);  	g_free(params.path_lib); +	g_free(params.path_locale);  	g_free(tmp); -	params.path_data = params.path_lib = NULL; +	params.path_data = params.path_lib =  params.path_locale = NULL;  	if (try_hardcoded) {  	    /* We tried the hardcoded paths, but still was unable to find the  | 
