libpurple/util.c

changeset 16078
3260aaa3f8ff
parent 16065
85316ed3bcc4
child 16124
8e5e3e9ada60
--- a/libpurple/util.c	Mon Apr 09 00:02:14 2007 +0000
+++ b/libpurple/util.c	Mon Apr 09 00:03:04 2007 +0000
@@ -2184,8 +2184,8 @@
 #endif
 }
 
-/* returns a string of the form ~/.gaim, where ~ is replaced by the user's home
- * dir. Note that there is no trailing slash after .gaim. */
+/* Returns the argument passed to -c IFF it was present, or ~/.gaim IFF it
+ * exists, else ~/.purple. */
 const char *
 purple_user_dir(void)
 {
@@ -2198,6 +2198,13 @@
 			g_strlcpy((char*) &home_dir, hd, sizeof(home_dir));
 			g_strlcat((char*) &home_dir, G_DIR_SEPARATOR_S ".gaim",
 					sizeof(home_dir));
+
+			if (g_file_test(home_dir, G_FILE_TEST_EXISTS))
+				return home_dir;
+
+			g_strlcpy((char*) &home_dir, hd, sizeof(home_dir));
+			g_strlcat((char*) &home_dir, G_DIR_SEPARATOR_S ".purple",
+					sizeof(home_dir));
 		}
 	}
 

mercurial