[Bf-blender-cvs] [d2c5959] master: fix T47484: Added fallback solution (copy exported file when rename is not supported)

Gaia Clary noreply at git.blender.org
Sat Feb 20 23:27:21 CET 2016


Commit: d2c59598341b41efb0e5d4620db20e129f7c999a
Author: Gaia Clary
Date:   Sat Feb 20 23:26:33 2016 +0100
Branches: master
https://developer.blender.org/rBd2c59598341b41efb0e5d4620db20e129f7c999a

fix T47484: Added fallback solution (copy exported file when rename is not supported)

===================================================================

M	source/blender/collada/DocumentExporter.cpp

===================================================================

diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 90e53fe..15e95a0 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -133,6 +133,7 @@ extern bool bc_has_object_type(LinkNode *export_set, short obtype);
 #include "LightExporter.h"
 #include "MaterialExporter.h"
 
+#include <errno.h>
 
 char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int n)
 {
@@ -188,8 +189,6 @@ int DocumentExporter::exportCurrentScene(Scene *sce)
 	COLLADABU::NativeString native_filename = make_temp_filepath(NULL, ".dae");
 	COLLADASW::StreamWriter *writer = new COLLADASW::StreamWriter(native_filename);
 
-	fprintf(stdout, "Collada export buffer: %s\n", native_filename.c_str());
-
 	// open <collada>
 	writer->startDocument();
 
@@ -330,12 +329,11 @@ int DocumentExporter::exportCurrentScene(Scene *sce)
 	delete writer;
 
 	// Finally move the created document into place
+	fprintf(stdout, "Collada export to: %s\n", this->export_settings->filepath);
 	int status = BLI_rename(native_filename.c_str(), this->export_settings->filepath);
-	if (status != 0)
-	{
-		fprintf(stdout, "Collada: Can't move buffer  %s\n", native_filename.c_str());
-		fprintf(stdout, "         to its destination %s\n", this->export_settings->filepath);
-		fprintf(stdout, "Reason : %s\n", errno ? strerror(errno) : "unknown error");
+	if (status != 0) {
+		status = BLI_copy(native_filename.c_str(), this->export_settings->filepath);
+		BLI_delete(native_filename.c_str(), false, false);
 	}
 	return status;
 }




More information about the Bf-blender-cvs mailing list