From ded299c755fd472bc0eb19789a1f40ab4d61a098 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 17 Mar 2012 15:27:26 -0400 Subject: [PATCH] Make relative paths work in pango.modules files Part of Bug 454017 - Make relative paths in pango.modules and pangorc files work relative to the file Patch from Anselm Kruis. --- pango/modules.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pango/modules.c b/pango/modules.c index 5ef2f31..ef952aa 100644 --- a/pango/modules.c +++ b/pango/modules.c @@ -400,7 +400,7 @@ script_info_free (PangoEngineScriptInfo *script_info, } static gboolean /* Returns true if succeeded, false if failed */ -process_module_file (FILE *module_file) +process_module_file (FILE *module_file, const gchar *module_file_dir) { GString *line_buf = g_string_new (NULL); GString *tmp_buf = g_string_new (NULL); @@ -438,6 +438,11 @@ process_module_file (FILE *module_file) switch (i) { case 0: + if (!g_path_is_absolute (tmp_buf->str)) { + const gchar *abs_file_name = g_build_filename (module_file_dir, tmp_buf->str, NULL); + g_string_assign (tmp_buf, abs_file_name); + g_free ((gpointer) abs_file_name); + } pair->module = find_or_create_module (tmp_buf->str); break; case 1: @@ -543,7 +548,9 @@ read_modules (void) module_file = g_fopen (files[n], "r"); if (module_file) { - process_module_file(module_file); + const gchar *module_file_dir = g_path_get_dirname (files[n]); + process_module_file(module_file, module_file_dir); + g_free ((gpointer) module_file_dir); fclose(module_file); } } -- 2.7.4