[yelp/gnome-2-30] [yelp-utils] Use g_build_filename to avoid missing slash problem
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp/gnome-2-30] [yelp-utils] Use g_build_filename to avoid missing slash problem
- Date: Thu, 18 Nov 2010 16:45:34 +0000 (UTC)
commit d8a0c136b10d174beae8fd5cfeeb83ef18e83846
Author: Shaun McCance <shaunm gnome org>
Date: Thu Nov 18 11:41:43 2010 -0500
[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.
src/yelp-utils.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]