Mercurial > pidgin.yaz
changeset 16017:198983d7e546
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.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 09 Apr 2007 00:03:04 +0000 |
parents | 1260354ed92d |
children | 5e5b7f9fcda8 |
files | libpurple/util.c |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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)); } }