changeset 32431:36fc641ca013

pidgin/finch: Make relative paths absolute with -c With a relative path (-c .purple-test), the WebKit message view rendering wasn't loading my theme code nor icons properly (which suggests that the webkit has a different base file URI).
author Paul Aurich <paul@darkrain42.org>
date Tue, 03 Jan 2012 19:29:20 +0000
parents f24f4e47dedb
children 79fdae8fa875
files finch/finch.c pidgin/gtkmain.c
diffstat 2 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/finch/finch.c	Tue Jan 03 06:32:26 2012 +0000
+++ b/finch/finch.c	Tue Jan 03 19:29:20 2012 +0000
@@ -339,7 +339,17 @@
 
 	/* set a user-specified config directory */
 	if (opt_config_dir_arg != NULL) {
-		purple_util_set_user_dir(opt_config_dir_arg);
+		if (g_path_is_absolute(opt_config_dir_arg)) {
+			purple_util_set_user_dir(opt_config_dir_arg);
+		} else {
+			/* Make an absolute (if not canonical) path */
+			char *cwd = g_get_current_dir();
+			char *path = g_build_path(G_DIR_SEPARATOR_S, cwd, opt_config_dir_arg, NULL);
+			purple_util_set_user_dir(path);
+			g_free(path);
+			g_free(cwd);
+		}
+
 		g_free(opt_config_dir_arg);
 	}
 
--- a/pidgin/gtkmain.c	Tue Jan 03 06:32:26 2012 +0000
+++ b/pidgin/gtkmain.c	Tue Jan 03 19:29:20 2012 +0000
@@ -719,7 +719,16 @@
 
 	/* set a user-specified config directory */
 	if (opt_config_dir_arg != NULL) {
-		purple_util_set_user_dir(opt_config_dir_arg);
+		if (g_path_is_absolute(opt_config_dir_arg)) {
+			purple_util_set_user_dir(opt_config_dir_arg);
+		} else {
+			/* Make an absolute (if not canonical) path */
+			char *cwd = g_get_current_dir();
+			char *path = g_build_path(G_DIR_SEPARATOR_S, cwd, opt_config_dir_arg, NULL);
+			purple_util_set_user_dir(path);
+			g_free(path);
+			g_free(cwd);
+		}
 	}
 
 	/*