[grisbi-cvs] grisbi/src gsb_file_util.c, 1.41, 1.42 utils_files.c, 1.46, 1.47

Gunee guneemwelloeux at users.sourceforge.net
Thu Dec 10 11:50:57 CET 2009


Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv18293

Modified Files:
	gsb_file_util.c utils_files.c 
Log Message:
Fixed the "accentuated character in path" problem on Windows (charset problem with native functions)
Bug 768

Index: utils_files.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_files.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- utils_files.c	1 Dec 2009 22:34:53 -0000	1.46
+++ utils_files.c	10 Dec 2009 10:50:53 -0000	1.47
@@ -299,7 +299,11 @@
  */
 gint utf8_remove(const gchar* utf8filename)
 {
+#ifdef _MSC_VER
+    return remove(g_locale_from_utf8(utf8filename, -1, NULL, NULL, NULL));
+#else
     return remove(g_filename_from_utf8(utf8filename,-1,NULL,NULL,NULL));
+#endif
 }
 
 /** 

Index: gsb_file_util.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_util.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- gsb_file_util.c	24 Aug 2009 14:03:03 -0000	1.41
+++ gsb_file_util.c	10 Dec 2009 10:50:53 -0000	1.42
@@ -114,16 +114,23 @@
     gulong iterator = 0;
     gulong bytes_read;
     gboolean eof = 0;
+	gchar *os_filename;
 
-    file = gzopen (filename, "rb");
+#ifdef _MSC_VER
+	os_filename = g_locale_from_utf8(filename, -1, NULL, NULL, NULL);
+#else
+	os_filename = g_strdup(filename);
+#endif
+
+    file = gzopen (os_filename, "rb");
     if (!file)
 	return FALSE;
 
     /* use stat to get the size of the file, windows ? */
-    if (stat (filename, &stat_buf))
+    if (stat (os_filename, &stat_buf))
     {
 	gchar *tmpstr = g_strdup_printf ( _("Grisbi cannot stat file %s, please check the file."),
-					  filename);
+					  os_filename);
 	dialogue_error (tmpstr);
 	g_free (tmpstr);
 	return FALSE;
@@ -165,7 +172,7 @@
 
 	g_free (content);
 	tmpstr = g_strdup_printf ( _("Failed to read from file '%s': %s"),
-				   filename, g_strerror (save_errno));
+				   os_filename, g_strerror (save_errno));
 	dialogue_error (tmpstr);
 	g_free (tmpstr);
 	return FALSE;
@@ -209,6 +216,7 @@
     *file_content = content;
 
     gzclose (file);
+	g_free(os_filename);
     return TRUE;
 }
 



More information about the cvs mailing list