diff options
author | Don Scorgie <dscorgie@src.gnome.org> | 2006-11-20 22:23:17 +0000 |
---|---|---|
committer | Don Scorgie <dscorgie@src.gnome.org> | 2006-11-20 22:23:17 +0000 |
commit | 24093b820549ba90eac5470967e417fcb445d27a (patch) | |
tree | d1958c326c95e77c2f67318c12b70a1c2ac4def7 | |
parent | 4f37dd7ec5b637ea0c7405bcd51fd5b7d38b2c20 (diff) | |
download | yelp-24093b820549ba90eac5470967e417fcb445d27a.tar.gz |
When info:dir contains a link to a subdir, but not an info name, work as
* src/yelp-utils.c:
When info:dir contains a link to a subdir,
but not an info name, work as expected
(Really fixes bug #371680)
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/yelp-utils.c | 29 |
2 files changed, 34 insertions, 0 deletions
@@ -1,5 +1,10 @@ 2006-11-20 Don Scorgie <dscorgie@cvs.gnome.org> + * src/yelp-utils.c: + When info:dir contains a link to a subdir, + but not an info name, work as expected + (Really fixes bug #371680) + * src/yelp-io-channel.c: Check the file exists and is valid before trying to read it (fixes bug #371680) diff --git a/src/yelp-utils.c b/src/yelp-utils.c index 445f7be5..fb8cd37d 100644 --- a/src/yelp-utils.c +++ b/src/yelp-utils.c @@ -905,6 +905,7 @@ convert_info_uri (gchar *uri) gchar *info_dot_info = NULL; gchar **infopaths = NULL; gboolean need_subdir = FALSE; + gchar *test_filename = NULL; gint i; @@ -979,6 +980,8 @@ convert_info_uri (gchar *uri) dir = g_dir_open (infopath[i], 0, NULL); if (dir) { while ((filename = g_dir_read_name (dir))) { + g_free (test_filename); + test_filename = g_strconcat (infopath[i], "/", filename, NULL); if (need_subdir && g_str_equal (filename, subdir)) { gchar *dirname = NULL; g_dir_close (dir); @@ -988,6 +991,31 @@ convert_info_uri (gchar *uri) filename = g_dir_read_name (dir); need_subdir = FALSE; } + else if (g_str_equal (filename,info_name) && + g_file_test (test_filename, G_FILE_TEST_IS_DIR)) { + /* In dir, they've specified the subdir but not the + * info file name. Here, do some work to get the name + * ...*/ + gchar *real_filename; + + g_dir_close (dir); + dir = g_dir_open (test_filename, 0, NULL); + + while ((real_filename = g_dir_read_name (dir))) { + if ((g_str_equal (info_dot_info, real_filename) || + g_pattern_match_string (pspec, real_filename) || + g_pattern_match_string (pspec1, real_filename) || + g_str_equal (info_name, real_filename))) { + doc_uri = g_strconcat ("file://", + test_filename, "/", + real_filename, + NULL); + g_dir_close (dir); + goto done; + } + } + + } else if (!need_subdir && (g_str_equal (info_dot_info, filename) || g_pattern_match_string (pspec, filename) || @@ -1027,6 +1055,7 @@ convert_info_uri (gchar *uri) g_pattern_spec_free (pspec); if (pspec1) g_pattern_spec_free (pspec1); + g_free (test_filename); g_free (subdir); g_free (info_dot_info); g_free (info_name); |