Do not store absolute pathnames for default modules * modules.c (find_or_create_module): When a relative pathname is given, prepend the pango default modules directory to get the absolute pathname. * querymodules.c (query_module): Output names of modules found in the pango default modules directory as relative to that directory. https://bugzilla.altlinux.org/show_bug.cgi?id=25938 --- pango/pango/modules.c +++ pango/pango/modules.c @@ -361,7 +361,11 @@ find_or_create_module (const char *raw_path) else #endif { - path = g_strdup (raw_path); + if (g_path_is_absolute (raw_path)) + path = g_strdup (raw_path); + else + path = g_build_filename (pango_get_lib_subdirectory (), + MODULE_VERSION, "modules", raw_path, NULL); } module = g_hash_table_lookup (dlloaded_modules, path); --- pango/pango/querymodules.c +++ pango/pango/querymodules.c @@ -110,6 +110,8 @@ string_from_script (PangoScript script) return value->value_nick; } +static char *pango_modules_directory; + static void query_module (const char *dir, const char *name) { @@ -145,18 +147,24 @@ query_module (const char *dir, const char *name) for (i=0; i SOEXT_LEN && strcmp (dent + len - SOEXT_LEN, SOEXT) == 0) + query_module (name, dent); + } + + g_dir_close (dir); +} + int main (int argc, char **argv) { @@ -232,43 +263,33 @@ main (int argc, char **argv) "# Automatically generated file, do not edit\n" "#\n"); + pango_modules_directory = g_build_filename (pango_get_lib_subdirectory (), + MODULE_VERSION, + "modules", + NULL); + if (argc == 1) /* No arguments given */ { char **dirs; int i; path = pango_config_key_get ("Pango/ModulesPath"); - if (!path) - path = g_build_filename (pango_get_lib_subdirectory (), - MODULE_VERSION, - "modules", - NULL); - - g_printf ("# ModulesPath = %s\n#\n", path); - dirs = pango_split_file_list (path); + g_printf ("# ModulesPath = %s\n#\n", path ? path : pango_modules_directory); - g_free (path); - - for (i=0; dirs[i]; i++) + if (path) { - GDir *dir = g_dir_open (dirs[i], 0, NULL); - if (dir) - { - const char *dent; + dirs = pango_split_file_list (path); - while ((dent = g_dir_read_name (dir))) - { - int len = strlen (dent); - if (len > SOEXT_LEN && strcmp (dent + len - SOEXT_LEN, SOEXT) == 0) - query_module (dirs[i], dent); - } + g_free (path); - g_dir_close (dir); - } - } + for (i=0; dirs[i]; i++) + query_dir (dirs[i]); - g_strfreev (dirs); + g_strfreev (dirs); + } + else + query_dir (pango_modules_directory); } else { @@ -280,5 +301,7 @@ main (int argc, char **argv) g_free (cwd); } + g_free (pango_modules_directory); + return 0; }