Author: akv
Date: 2013-04-27 21:10:16 +0200 (Sat, 27 Apr 2013)
New Revision: 4372

Modified:
   branches/4175-enfuse/src/rs-enfuse.c
Log:
Deleting temporary files after processing.

Modified: branches/4175-enfuse/src/rs-enfuse.c
===================================================================
--- branches/4175-enfuse/src/rs-enfuse.c        2013-04-27 16:06:52 UTC (rev 
4371)
+++ branches/4175-enfuse/src/rs-enfuse.c        2013-04-27 19:10:16 UTC (rev 
4372)
@@ -252,7 +252,6 @@
       printf("command: %s\n", command->str);
       if (system(command->str));
       g_string_free(command, TRUE);
-      g_list_free(files);
     }
   return aligned_names;
 }
@@ -277,10 +276,21 @@
       printf("command: %s\n", command->str);
       if(system(command->str));
       g_string_free(command, TRUE);
-      g_list_free(files);
     }
 }
 
+void
+delete_files_in_list(GList *list)
+{
+  gint i;
+  gchar *name = NULL;
+  for(i=0; i<g_list_length(list); i++)
+    {
+      name = (gchar*) g_list_nth_data(list, i);
+      g_unlink(name);
+    }
+}
+
 gchar * rs_enfuse(RS_BLOB *rs, GList *files, gboolean quick, gint boundingbox)
 {
   gint num_selected = g_list_length(files);
@@ -393,6 +403,14 @@
   if (quick == FALSE)
     gui_progress_advance_one(progress); /* 4 - after enfusing */
 
+  /* delete all temporary files */
+  if (exported_names != aligned_names) {
+      delete_files_in_list(aligned_names);
+      g_list_free(aligned_names);
+  }
+  delete_files_in_list(exported_names);
+  g_list_free(exported_names);
+
   /* FIXME: should use the photo in the middle as it's averaged between it... 
*/
   rs_exif_copy(first, temp_filename, "sRGB", RS_EXIF_FILE_TYPE_PNG);
   if (first)


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to