[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50556] trunk/blender/source/blender/ collada/ImageExporter.cpp: #31682: partial fix (the export): Avoid to copy exported image into itself

Gaia Clary gaia.clary at machinimatrix.org
Wed Sep 12 17:41:59 CEST 2012


Revision: 50556
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50556
Author:   gaiaclary
Date:     2012-09-12 15:41:58 +0000 (Wed, 12 Sep 2012)
Log Message:
-----------
#31682: partial fix (the export): Avoid to copy exported image into itself

Modified Paths:
--------------
    trunk/blender/source/blender/collada/ImageExporter.cpp

Modified: trunk/blender/source/blender/collada/ImageExporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/ImageExporter.cpp	2012-09-12 13:17:22 UTC (rev 50555)
+++ trunk/blender/source/blender/collada/ImageExporter.cpp	2012-09-12 15:41:58 UTC (rev 50556)
@@ -119,12 +119,15 @@
 			
 				// This image is already located on the file system.
 				// But we want to create copies here.
-				// To avoid overwroting images with same file name but
-				// differenet source locations
+				// To move images into the same export directory.
+				// Note: If an image is already located in the exprot folder,
+				// skip the copy (as it would result in a file copy error
 
-				if (BLI_copy(source_path, export_path) != 0) {
-					fprintf(stderr, "Collada export: Cannot copy image:\n source:%s\ndest :%s\n", source_path, export_path);
-					return;
+				if (BLI_path_cmp(source_path, export_path) != 0) {
+					if (BLI_copy(source_path, export_path) != 0) {
+						fprintf(stderr, "Collada export: Cannot copy image:\n source:%s\ndest :%s\n", source_path, export_path);
+						return;
+					}
 				}
 
 				BLI_strncpy(export_path, export_file, sizeof(export_path));
@@ -132,7 +135,7 @@
 			}
 			else {
 
-				// Do not make any vopies, but use the source path directly as reference
+				// Do not make any copies, but use the source path directly as reference
 				// to the original image
 
 				BLI_strncpy(export_path, source_path, sizeof(export_path));




More information about the Bf-blender-cvs mailing list