From 14d052233d0d69a0aa3dbf8b32fbb3c0defdca23 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Tue, 11 Aug 2009 16:16:31 +0200 Subject: [PATCH] Fixes NB#131375, show "replace file" confirmation note, when saving attachments and the file already exists --- src/modest-utils.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/modest-utils.c b/src/modest-utils.c index 8507fd5..b050d0a 100644 --- a/src/modest-utils.c +++ b/src/modest-utils.c @@ -107,14 +107,18 @@ gboolean modest_utils_file_exists (const gchar *filename) { gboolean result = FALSE; - gchar *escaped; + gchar *path; g_return_val_if_fail (filename, FALSE); - escaped = g_uri_escape_string (filename, NULL, FALSE); - if (g_access (escaped, F_OK) == 0) + path = strstr (filename, "file://"); + if (!path) + path = (gchar *) filename; + else + path = (gchar *) filename + strlen ("file://"); + + if (g_access (path, F_OK) == 0) result = TRUE; - g_free (escaped); return result; } -- 1.7.9.5