diff src/util.c @ 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 599d6ac9bbfe
children afff7b6ae29f
line wrap: on
line diff
--- 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)