Temp streams are removed always when same file is requested to be saved
authorJose Dapena Paz <jdapena@igalia.com>
Tue, 17 Mar 2009 20:45:57 +0000 (20:45 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Tue, 17 Mar 2009 20:45:57 +0000 (20:45 +0000)
pmo-trunk-r8129

src/modest-utils.c

index eb21481..33b5a04 100644 (file)
@@ -155,6 +155,12 @@ modest_utils_create_temp_stream (const gchar *orig_name, const gchar *hash_base,
        }
 
        filepath = g_strconcat (tmpdir, "/", orig_name, NULL);
        }
 
        filepath = g_strconcat (tmpdir, "/", orig_name, NULL);
+
+       /* if file exists, first we try to remove it */
+       if (modest_utils_file_exists (filepath)) {
+               g_unlink (filepath);
+       }
+
        /* don't overwrite if it already exists, even if it is writable */
        if (modest_utils_file_exists (filepath)) {
                if (path!=NULL) {
        /* don't overwrite if it already exists, even if it is writable */
        if (modest_utils_file_exists (filepath)) {
                if (path!=NULL) {