soc.2009.webkitmessageview: f2899c44: make a get_absolute_path function.

tdrhq at soc.pidgin.im tdrhq at soc.pidgin.im
Tue Aug 25 12:06:34 EDT 2009


-----------------------------------------------------------------
Revision: f2899c44cb09ec5157437b8877e2390ae7925ee3
Ancestor: d3203bf25024da03b0be45318df36b80ccb1da85
Author: tdrhq at soc.pidgin.im
Date: 2009-08-10T10:34:52
Branch: im.pidgin.soc.2009.webkitmessageview
URL: http://d.pidgin.im/viewmtn/revision/info/f2899c44cb09ec5157437b8877e2390ae7925ee3

Modified files:
        pidgin/plugins/adiumthemes/webkit.c

ChangeLog: 

make a get_absolute_path function.

-------------- next part --------------
============================================================
--- pidgin/plugins/adiumthemes/webkit.c	f9fe89a5908829db08a416aa8d5d1b07fbf181cf
+++ pidgin/plugins/adiumthemes/webkit.c	500890a0db5702a468fde431c77ba6da6e4c07a5
@@ -83,6 +83,17 @@ static void  *handle = NULL;
 static char  *cur_style_dir = NULL;
 static void  *handle = NULL;
 
+static inline char* get_absolute_path (const char *path)
+{
+	if (g_path_is_absolute (path)) return g_strdup (path);
+	else {
+		char* cwd = g_get_current_dir (), *ret;
+		ret = g_build_filename (cwd, path, NULL);
+		g_free (cwd);
+		return ret;
+	}
+}
+
 static PidginMessageStyle* pidgin_message_style_new (const char* styledir)
 {
 	PidginMessageStyle* ret = g_new0 (PidginMessageStyle, 1);
@@ -623,13 +634,7 @@ get_style_directory_list ()
 	char *user_dir, *user_style_dir, *global_style_dir;
 	GList *list1, *list2;
 
-	user_dir = g_strdup (purple_user_dir ());
-	if (!g_path_is_absolute (user_dir)) {
-		char* cur = g_get_current_dir ();
-		g_free (user_dir);
-		user_dir = g_build_filename (cur, purple_user_dir(), NULL);
-		g_free (cur);
-	}
+	user_dir = get_absolute_path (purple_user_dir ());
 
 	user_style_dir = g_build_filename (user_dir, "styles", NULL);
 	global_style_dir = g_build_filename (DATADIR, "pidgin", "styles", NULL);


More information about the Commits mailing list