1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
From d8a0c136b10d174beae8fd5cfeeb83ef18e83846 Mon Sep 17 00:00:00 2001
From: Shaun McCance <shaunm@gnome.org>
Date: Thu, 18 Nov 2010 16:41:43 +0000
Subject: [yelp-utils] Use g_build_filename to avoid missing slash problem
We were assuming the results of g_get_system_data_dirs have a trailing
slash. They might not, if you set XDG_DATA_DIRS without them.
---
diff --git a/src/yelp-utils.c b/src/yelp-utils.c
index 7fb79e5..0027e08 100644
--- a/src/yelp-utils.c
+++ b/src/yelp-utils.c
@@ -116,15 +116,15 @@ resolve_process_ghelp (char *uri, gchar **result)
hash = NULL;
}
for (i = 0; type != YELP_RRN_TYPE_MAL && dirs[i]; i++) {
- gchar *path = g_strdup_printf ("%sgnome/help/%s", dirs[i], dir);
+ gchar *path = g_build_filename (dirs[i], "gnome", "help", dir, NULL);
if (g_file_test (path, G_FILE_TEST_IS_DIR)) {
const gchar * const *langs = g_get_language_names ();
gint j;
for (j = 0; type != YELP_RRN_TYPE_MAL && langs[j]; j++) {
- gchar *index = g_strdup_printf ("%sgnome/help/%s/%s/index.page", dirs[i], dir, langs[j]);
+ gchar *index = g_build_filename (dirs[i], "gnome", "help", dir, langs[j], "index.page", NULL);
if (g_file_test (index, G_FILE_TEST_IS_REGULAR)) {
type = YELP_RRN_TYPE_MAL;
- *result = g_strdup_printf ("%sgnome/help/%s/%s/", dirs[i], dir, langs[j]);
+ *result = g_build_filename (dirs[i], "gnome", "help", dir, langs[j], NULL);
}
g_free (index);
}
--
cgit v0.9
|