Salome HOME
Fix for "[CEA]: Windows version: Dump Python: there is an error in the file name...
authorrnv <rnv@opencascade.com>
Mon, 13 May 2019 13:41:55 +0000 (16:41 +0300)
committerrnv <rnv@opencascade.com>
Mon, 13 May 2019 13:41:55 +0000 (16:41 +0300)
src/BREPPlugin/BREPPlugin_IOperations.cxx
src/IGESPlugin/IGESPlugin_IOperations.cxx
src/STEPPlugin/STEPPlugin_IOperations.cxx
src/STLPlugin/STLPlugin_IOperations.cxx
src/VTKPlugin/VTKPlugin_IOperations.cxx
src/XAOPlugin/XAOPlugin_IOperations.cxx

index 41e1a070b7f6cd4da00e3d4421dbfa420a834033..c5ab6d6303e4df6a148d12cae0b6fdc981736ad6 100644 (file)
@@ -25,6 +25,7 @@
 #include "BREPPlugin_IImport.hxx"
 
 // KERNEL includes
+#include <Basics_DirUtils.hxx>
 #include <utilities.h>
 
 // GEOM includes
@@ -102,8 +103,9 @@ void BREPPlugin_IOperations::ExportBREP( const Handle(GEOM_Object)      theOrigi
   }
 
   //Make a Python command
+  std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
   GEOM::TPythonDump(aFunction) << "geompy.ExportBREP(" << theOriginal << ", \""
-    << theFileName.ToCString() << "\" )";
+    << convFileName.c_str() << "\" )";
 
   SetErrorCode(OK);
 }
@@ -158,7 +160,8 @@ BREPPlugin_IOperations::ImportBREP( const TCollection_AsciiString& theFileName )
 
   //Make a Python command
   GEOM::TPythonDump pd (aFunction);
-  pd << aSeq << " = geompy.ImportBREP(\"" << theFileName.ToCString() << "\" )";
+  std::string convFileName =  Kernel_Utils::BackSlashToSlash( theFileName.ToCString() );
+  pd << aSeq << " = geompy.ImportBREP(\"" << convFileName.c_str() << "\" )";
   SetErrorCode(OK);
 
   return aSeq;
index ca9b3224d8c25a9a056b553c00c9974a707b9a75..59581817bb400173a4013f526479f6136ac7a5b1 100644 (file)
@@ -25,6 +25,7 @@
 #include "IGESPlugin_IImport.hxx"
 
 // KERNEL includes
+#include <Basics_DirUtils.hxx>
 #include <utilities.h>
 
 // GEOM includes
@@ -106,8 +107,9 @@ void IGESPlugin_IOperations::ExportIGES( const Handle(GEOM_Object)      theOrigi
   }
 
   //Make a Python command
+  std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
   GEOM::TPythonDump(aFunction) << "geompy.ExportIGES(" << theOriginal << ", \""
-    << theFileName.ToCString() << "\", \"" << theVersion.ToCString() << "\" )";
+    << convFileName.c_str() << "\", \"" << theVersion.ToCString() << "\" )";
 
   SetErrorCode(OK);
 }
@@ -164,10 +166,11 @@ IGESPlugin_IOperations::ImportIGES( const TCollection_AsciiString& theFileName,
 
   //Make a Python command
   GEOM::TPythonDump pd (aFunction);
+  std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
   if( theIsIgnoreUnits )
-    pd << aSeq << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\", True)";
+    pd << aSeq << " = geompy.ImportIGES(\"" << convFileName.c_str() << "\", True)";
   else
-    pd << aSeq << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\")";
+    pd << aSeq << " = geompy.ImportIGES(\"" << convFileName.c_str() << "\")";
   SetErrorCode(OK);
 
   return aSeq;
index 58a1a611ec62013f707f4b739d514beb603ae8de..06b3cd25ec4599168c1c220d9d138ed9611a5d1c 100644 (file)
@@ -25,6 +25,7 @@
 #include "STEPPlugin_IImport.hxx"
 
 // KERNEL includes
+#include <Basics_DirUtils.hxx>
 #include <utilities.h>
 
 // GEOM includes
@@ -151,8 +152,9 @@ void STEPPlugin_IOperations::ExportSTEP
   }
 
   //Make a Python command
+  std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
   GEOM::TPythonDump(aFunction) << "geompy.ExportSTEP(" << theOriginal << ", \""
-    << theFileName.ToCString() << "\", " << theUnit << " )";
+    << convFileName.c_str() << "\", " << theUnit << " )";
 
   SetErrorCode(OK);
 }
@@ -211,7 +213,8 @@ STEPPlugin_IOperations::ImportSTEP(const TCollection_AsciiString& theFileName,
 
   //Make a Python command
   GEOM::TPythonDump pd (aFunction);
-  pd << aSeq << " = geompy.ImportSTEP(\"" << theFileName.ToCString() << "\", ";
+  std::string convFileName =  Kernel_Utils::BackSlashToSlash( theFileName.ToCString() );
+  pd << aSeq << " = geompy.ImportSTEP(\"" << convFileName.c_str() << "\", ";
   pd << (theIsIgnoreUnits ? "True" : "False");
   pd << ", " << (IsCreateAssemblies ? "True" : "False");
   pd << ")";
index e5b97e3657a2214c55c4b658d9b5c01272a6d9d9..c0e492a42f47623c77342c36040c504a9a7c3e80 100644 (file)
@@ -25,6 +25,7 @@
 #include "STLPlugin_IImport.hxx"
 
 // KERNEL includes
+#include <Basics_DirUtils.hxx>
 #include <utilities.h>
 
 // GEOM includes
@@ -111,8 +112,9 @@ void STLPlugin_IOperations::ExportSTL( const Handle(GEOM_Object)      theOrigina
   }
 
   //Make a Python command
+  std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
   GEOM::TPythonDump(aFunction) << "geompy.ExportSTL(" << theOriginal << ", \""
-    << theFileName.ToCString() << "\", " << theIsASCII << ", " << theDeflection << ", "
+    << convFileName.c_str() << "\", " << theIsASCII << ", " << theDeflection << ", "
     << theIsRelative << ")";
 
   SetErrorCode(OK);
@@ -168,7 +170,8 @@ STLPlugin_IOperations::ImportSTL( const TCollection_AsciiString& theFileName )
 
   //Make a Python command
   GEOM::TPythonDump pd (aFunction);
-  pd << aSeq << " = geompy.ImportSTL(\"" << theFileName.ToCString() << "\" )";
+  std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
+  pd << aSeq << " = geompy.ImportSTL(\"" << convFileName.c_str() << "\" )";
   SetErrorCode(OK);
 
   return aSeq;
index 8ffda5c6eea334551743b59bf8cefe44b3345f58..b5ca0e326e746eb85accfc802e0564854fd3ef7d 100644 (file)
@@ -23,6 +23,7 @@
 #include "VTKPlugin_IExport.hxx"
 
 // KERNEL includes
+#include <Basics_DirUtils.hxx>
 #include <utilities.h>
 
 // GEOM includes
@@ -101,8 +102,9 @@ void VTKPlugin_IOperations::ExportVTK( const Handle(GEOM_Object)      theOrigina
   }
 
   //Make a Python command
+  std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
   GEOM::TPythonDump(aFunction) << "geompy.ExportVTK(" << theOriginal << ", \""
-    << theFileName.ToCString() << "\", " << theDeflection << ")";
+    << convFileName.c_str() << "\", " << theDeflection << ")";
 
   SetErrorCode(OK);
 }
index f725f43b7b66ba8d1cdab859d69b65a30498cd91..91c0c3e4f028b94e33212c7719a2a3327c1f6861 100644 (file)
@@ -23,6 +23,7 @@
 #include "XAOPlugin_IImportExport.hxx"
 
 // KERNEL includes
+#include <Basics_DirUtils.hxx>
 #include <utilities.h>
 #include <Utils_SALOME_Exception.hxx>
 
@@ -353,6 +354,7 @@ bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape,
 
   // make a Python command
   GEOM::TPythonDump pd(exportFunction);
+  std::string convFileName = Kernel_Utils::BackSlashToSlash(fileName);
   pd << "exported = geompy.ExportXAO(" << shape;
 
   // list of groups
@@ -379,7 +381,7 @@ bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape,
     }
   }
   pd << "], ";
-  pd << "\"" << author << "\", \"" << fileName << "\", \"" << shapeFileName << "\")";
+  pd << "\"" << author << "\", \"" << convFileName.c_str() << "\", \"" << shapeFileName << "\")";
 
   SetErrorCode(OK);
   delete xaoObject;
@@ -664,8 +666,9 @@ bool XAOPlugin_IOperations::ImportXAO( const char* fileName,
       pd << obj << ((i < nbFields) ? ", " : "");
     }
   }
+  std::string convFileName =  Kernel_Utils::BackSlashToSlash( fileName );
   pd << "]";
-  pd << ") = geompy.ImportXAO(\"" << fileName << "\")";
+  pd << ") = geompy.ImportXAO(\"" << convFileName.c_str() << "\")";
 
   delete xaoObject;
   SetErrorCode(OK);