gnucash maint: Fix localedir relocation.
John Ralls
jralls at code.gnucash.org
Tue Sep 18 19:40:42 EDT 2018
Updated via https://github.com/Gnucash/gnucash/commit/2d565215 (commit)
from https://github.com/Gnucash/gnucash/commit/59a6ebc3 (commit)
commit 2d565215cd3306f477ef51b12cfae878438dde9b
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Sep 18 16:08:48 2018 -0700
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.
diff --git a/libgnucash/core-utils/gnc-path.c b/libgnucash/core-utils/gnc-path.c
index e672432..e6e7e13 100644
--- a/libgnucash/core-utils/gnc-path.c
+++ b/libgnucash/core-utils/gnc-path.c
@@ -24,6 +24,7 @@
#include "gncla-dir.h"
#include <stdio.h>
#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;
}
Summary of changes:
libgnucash/core-utils/gnc-path.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
More information about the gnucash-changes
mailing list