diff src/util.c @ 7622:072feee65244

[gaim-migrate @ 8246] this doesn't seem to break directory creation on *NIX, and I think it might fix it for win32, so here goes nothin' committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Mon, 24 Nov 2003 06:50:20 +0000
parents a83aaf250284
children e293d0c42ccb
line wrap: on
line diff
--- a/src/util.c	Mon Nov 24 03:05:16 2003 +0000
+++ b/src/util.c	Mon Nov 24 06:50:20 2003 +0000
@@ -1187,7 +1187,7 @@
 	return NULL;
 }
 
-int gaim_build_dir (char *path, int mode)
+int gaim_build_dir (const char *path, int mode)
 {
 	struct stat st;
 	char *dir, **components, delim[] = { G_DIR_SEPARATOR, '\0' };
@@ -1197,10 +1197,13 @@
 		return -1;
 
 	dir = g_new0(char, strlen(path) + 1);
-	components = g_strsplit(path + 1, delim, -1);
+	components = g_strsplit(path, delim, -1);
 	len = 0;
 	for (cur = 0; components[cur] != NULL; cur++) {
-		dir[len++] = G_DIR_SEPARATOR;
+		if(*components[cur] == '\0')
+			continue;
+		if(cur != 0)
+			dir[len++] = G_DIR_SEPARATOR;
 		strcpy(dir + len, components[cur]);
 		len += strlen(components[cur]);
 		if (stat(dir, &st) == 0) {