summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2012-03-17 15:27:26 -0400
committerBehdad Esfahbod <behdad@behdad.org>2012-03-17 15:27:26 -0400
commitded299c755fd472bc0eb19789a1f40ab4d61a098 (patch)
treea2cd8653dc46824e092a2903b690abd84eeb9f28
parent8206a1c0eccba741423ba67c94cb18faf6fd7daf (diff)
downloadpango-ded299c755fd472bc0eb19789a1f40ab4d61a098.tar.gz
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.
-rw-r--r--pango/modules.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/pango/modules.c b/pango/modules.c
index 5ef2f315..ef952aaf 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);
}
}