Salome HOME
Fix for "[CEA]: Windows version: Dump Python: there is an error in the file name...
[modules/geom.git] / src / XAOPlugin / XAOPlugin_IOperations.cxx
index f77a29aae7869facb1ee759ab2627232aae642c7..91c0c3e4f028b94e33212c7719a2a3327c1f6861 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -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;
@@ -527,8 +529,6 @@ bool XAOPlugin_IOperations::ImportXAO( const char* fileName,
     TDF_Label freeLabel = group->GetFreeLabel();
     TDataStd_Integer::Set(freeLabel, (Standard_Integer) getGroupDimension(xaoGroup));
     groups->Append(group);
-
-    function = group->GetLastFunction();
   }
 
   // create the fields
@@ -666,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);