# HG changeset patch # User Richard Laager # Date 1176076984 0 # Node ID 198983d7e54606fa7ba70b168f70444820fd86ee # Parent 1260354ed92d3b60e39bb68310829660fbae0f41 Use ~/.gaim if it exists, else ~/.purple. If you think you can make this code more efficient, please do. It works for me, so I'm shipping it. diff -r 1260354ed92d -r 198983d7e546 libpurple/util.c --- 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)); } }