From 2d565215cd3306f477ef51b12cfae878438dde9b Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 18 Sep 2018 16:08:48 -0700 Subject: [PATCH] Fix localedir relocation. Since LOCALEDIR is now always absolute we need to see if there's a prefix and if LOCALEDIR is a subdir of PREFIX instead. --- libgnucash/core-utils/gnc-path.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libgnucash/core-utils/gnc-path.c b/libgnucash/core-utils/gnc-path.c index e6724329dd..e6e7e13e45 100644 --- a/libgnucash/core-utils/gnc-path.c +++ b/libgnucash/core-utils/gnc-path.c @@ -24,6 +24,7 @@ #include "gncla-dir.h" #include #include "binreloc.h" +#include "gnc-filepath-utils.h" gchar *gnc_path_get_prefix() { @@ -138,13 +139,19 @@ gchar *gnc_path_get_gtkbuilderdir() * @returns A newly allocated string. */ gchar *gnc_path_get_localedir() { - if (g_path_is_absolute (LOCALEDIR)) - return g_strdup(LOCALEDIR); + gchar *prefix = gnc_path_get_prefix(); + char *locale_subdir = gnc_file_path_relative_part (PREFIX, LOCALEDIR); + if (prefix == NULL || g_strcmp0 (locale_subdir, LOCALEDIR) == 0) + { + g_free (prefix); + g_free (locale_subdir); + return LOCALEDIR; + } else { - gchar *prefix = gnc_path_get_prefix(); - gchar *result = g_build_filename (prefix, LOCALEDIR, (char*)NULL); + gchar *result = g_build_filename (prefix, locale_subdir, (char*)NULL); g_free (prefix); + g_free (locale_subdir); //printf("Returning localedir %s\n", result); return result; }