[gaim-migrate @ 15519]

Tue, 07 Feb 2006 09:50:06 +0000

author
Richard Laager <rlaager@pidgin.im>
date
Tue, 07 Feb 2006 09:50:06 +0000
changeset 13157
ef4da8c7626a
parent 13156
539a637c61dc
child 13158
3b4295931fd6

[gaim-migrate @ 15519]
Given that the timezone is coming from the locale, it might be non-ASCII. Let's make sure to escape everything. This seems like the cleanest and most portable way of dealing with the filename encoding. As these are logs, I'd like their names to be all ASCII, to avoid problems when moving them between filesystems with different encodings.

src/log.c file | annotate | diff | comparison | revisions
--- a/src/log.c	Tue Feb 07 09:41:22 2006 +0000
+++ b/src/log.c	Tue Feb 07 09:50:06 2006 +0000
@@ -637,7 +637,7 @@
 
 		filename = g_strdup_printf("%s%s", date, ext ? ext : "");
 
-		path = g_build_filename(dir, filename, NULL);
+		path = g_build_filename(dir, gaim_escape_filename(filename), NULL);
 		g_free(dir);
 		g_free(filename);
 
@@ -664,7 +664,7 @@
 {
 	GDir *dir;
 	GList *list = NULL;
-	const char *filename;
+	const char *fname;
 	char *path;
 
 	if(!account)
@@ -680,8 +680,10 @@
 		return NULL;
 	}
 
-	while ((filename = g_dir_read_name(dir)))
+	while ((fname = g_dir_read_name(dir)))
 	{
+		const char *filename = gaim_unescape_filename(fname);
+
 		if (gaim_str_has_suffix(filename, ext) &&
 		    strlen(filename) >= (17 + strlen(ext)))
 		{
@@ -886,7 +888,7 @@
 
 		gaim_build_dir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
 
-		filename = g_build_filename(dir, date, NULL);
+		filename = g_build_filename(dir, gaim_escape_filename(date), NULL);
 		g_free(dir);
 
 		log->logger_data = g_fopen(filename, "a");

mercurial