Mercurial > pidgin
changeset 8596:56360561af5e
[gaim-migrate @ 9347]
" This patch creates a new command line argument ('-c' or
'--config') that allows the location of tha gaim prefs
files to be located somewhere other than in ~/.gaim
The patch also removes the -f argument as it is no
longer relevant since .gaimrc is all but gone.
The one "weirdness" is that for the session managment
support, the --config argument will allways appear to
be specified and will contain either the custom value
(if specified) or the canonical version of ~/.gaim (if
no custom -c is specified). If this should be done
differently, let me know." --Daniel Atallah
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Tue, 06 Apr 2004 14:29:51 +0000 |
parents | 1d5e31e518fc |
children | d0d1507b52b4 |
files | plugins/spellchk.c src/gaim.h src/gaimrc.c src/main.c src/session.c src/util.c src/util.h |
diffstat | 7 files changed, 34 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/spellchk.c Tue Apr 06 05:41:12 2004 +0000 +++ b/plugins/spellchk.c Tue Apr 06 14:29:51 2004 +0000 @@ -305,7 +305,7 @@ char tempfilename[BUF_LONG]; int fd; - name = g_build_filename(gaim_home_dir(), ".gaim", "dict", NULL); + name = g_build_filename(gaim_user_dir(), "dict", NULL); strcpy(tempfilename, name); strcat(tempfilename,".XXXXXX"); fd = g_mkstemp(tempfilename);
--- a/src/gaim.h Tue Apr 06 05:41:12 2004 +0000 +++ b/src/gaim.h Tue Apr 06 14:29:51 2004 +0000 @@ -31,7 +31,6 @@ /* Globals in main.c */ extern int opt_away; extern char *opt_away_arg; -extern char *opt_rcfile_arg; extern int opt_debug; extern GSList *message_queue;
--- a/src/gaimrc.c Tue Apr 06 05:41:12 2004 +0000 +++ b/src/gaimrc.c Tue Apr 06 14:29:51 2004 +0000 @@ -1483,9 +1483,7 @@ return; } - if (opt_rcfile_arg) - g_snprintf(buf, sizeof(buf), "%s", opt_rcfile_arg); - else if (gaim_home_dir()) + if (gaim_home_dir()) g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S ".gaimrc", gaim_home_dir()); else { set_defaults(); @@ -1545,10 +1543,6 @@ "Saving preferences on request\n"); request_save_prefs = 0; } - } else if (opt_rcfile_arg) { - g_snprintf(buf, sizeof(buf), _("Could not open config file %s."), opt_rcfile_arg); - gaim_notify_error(NULL, NULL, buf, NULL); - set_defaults(); } else { set_defaults(); }
--- a/src/main.c Tue Apr 06 05:41:12 2004 +0000 +++ b/src/main.c Tue Apr 06 14:29:51 2004 +0000 @@ -87,7 +87,6 @@ int opt_away = 0; int docklet_count = 0; char *opt_away_arg = NULL; -char *opt_rcfile_arg = NULL; int opt_debug = 0; #if HAVE_SIGNAL_H @@ -530,7 +529,7 @@ " account(s) to use, seperated by commas)\n" " -n, --loginwin don't automatically login; show login window\n" " -u, --user=NAME use account NAME\n" - " -f, --file=FILE use FILE as config\n" + " -c, --config=DIR use DIR for config files\n" " -d, --debug print debugging messages to stdout\n" " -v, --version display the current version and exit\n" " -h, --help display this help and exit\n"), VERSION, name); @@ -623,7 +622,7 @@ /*{"login", optional_argument, NULL, 'l'}, */ {"loginwin", no_argument, NULL, 'n'}, {"user", required_argument, NULL, 'u'}, - {"file", required_argument, NULL, 'f'}, + {"config", required_argument, NULL, 'c'}, {"debug", no_argument, NULL, 'd'}, {"version", no_argument, NULL, 'v'}, {"session", required_argument, NULL, 's'}, @@ -758,9 +757,9 @@ opterr = 1; while ((opt = getopt_long(argc, argv, #ifndef _WIN32 - "adhu:f:vns:", + "adhu:c:vns:", #else - "adhu:f:vn", + "adhu:c:vn", #endif long_options, NULL)) != -1) { switch (opt) { @@ -774,8 +773,8 @@ case 'd': /* debug */ opt_debug = 1; break; - case 'f': - opt_rcfile_arg = g_strdup(optarg); + case 'c': /* use specified config dir */ + set_gaim_user_dir(optarg); break; case 's': /* use existing session ID */ opt_session_arg = g_strdup(optarg);
--- a/src/session.c Tue Apr 06 05:41:12 2004 +0000 +++ b/src/session.c Tue Apr 06 14:29:51 2004 +0000 @@ -26,8 +26,6 @@ #include "debug.h" #include "eventloop.h" -extern char *opt_rcfile_arg; - #ifdef USE_SM #include <X11/ICE/ICElib.h> @@ -145,7 +143,7 @@ gchar **ret; if (client_id) i += 2; - if (opt_rcfile_arg) i += 2; + i += 2; /* we will specify gaim's user dir */ ret = g_new(gchar *, i); ret[j++] = g_strdup(myself); @@ -155,10 +153,8 @@ ret[j++] = g_strdup(client_id); } - if (opt_rcfile_arg) { - ret[j++] = g_strdup("--file"); - ret[j++] = g_strdup(opt_rcfile_arg); - } + ret[j++] = g_strdup("--config"); + ret[j++] = g_strdup(gaim_user_dir()); ret[j++] = NULL;
--- a/src/util.c Tue Apr 06 05:41:12 2004 +0000 +++ b/src/util.c Tue Apr 06 14:29:51 2004 +0000 @@ -61,10 +61,9 @@ } GaimFetchUrlData; - +static char custom_home_dir[MAXPATHLEN]; static char home_dir[MAXPATHLEN]; - /************************************************************************** * Base16 Functions **************************************************************************/ @@ -1528,17 +1527,25 @@ char * gaim_user_dir(void) { - const gchar *hd = gaim_home_dir(); + if (custom_home_dir != NULL && strlen(custom_home_dir) > 0) { + strcpy ((char*) &home_dir, (char*) &custom_home_dir); + } else { + const gchar *hd = gaim_home_dir(); - if(hd) - { - strcpy( (char*)&home_dir, hd ); - strcat( (char*)&home_dir, G_DIR_SEPARATOR_S ".gaim" ); - - return (gchar*)&home_dir; + if (hd) { + strcpy((char*) &home_dir, hd); + strcat((char*) &home_dir, G_DIR_SEPARATOR_S ".gaim"); + } } - return NULL; + return home_dir; +} + +void set_gaim_user_dir(const char *dir) +{ + if (dir != NULL && strlen(dir) > 0) { + strcpy((char*) &custom_home_dir, dir); + } } int gaim_build_dir (const char *path, int mode)
--- a/src/util.h Tue Apr 06 05:41:12 2004 +0000 +++ b/src/util.h Tue Apr 06 14:29:51 2004 +0000 @@ -325,6 +325,12 @@ char *gaim_user_dir(void); /** + * Define a custom gaim settings directory, overriding the default (user's home directory/.gaim) + * @param dir The custom settings directory + */ +void set_gaim_user_dir(const char *dir); + +/** * Builds a complete path from the root, making any directories along * the path which do not already exist. *