Salome HOME
NPAL14828: Impossible to load a study created in batch mode. Use './' instead of... V3_2_5
authorjfa <jfa@opencascade.com>
Thu, 8 Feb 2007 11:22:58 +0000 (11:22 +0000)
committerjfa <jfa@opencascade.com>
Thu, 8 Feb 2007 11:22:58 +0000 (11:22 +0000)
src/GEOM_I/GEOM_Gen_i.cc

index 26b9b77479da207918cddbf53e0ed06d9061c7cb..a5e9c2e54294316abad7489ddc87f2b112685ec4 100644 (file)
@@ -287,6 +287,17 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
   SALOMEDS::TMPFile_var aStreamFile;
   // Get a temporary directory to store a file
   std::string aTmpDir = (isMultiFile)?theURL:SALOMEDS_Tool::GetTmpDir();
+
+  // OCCT BUG: cannot save a document (in current folder)
+  // if directory name is empty
+  if (aTmpDir.size() == 0) {
+#ifdef WNT
+    aTmpDir = ".\\";
+#else
+    aTmpDir = "./";
+#endif
+  }
+
   // Create a list to store names of created files
   SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
   aSeq->length(1);
@@ -338,8 +349,20 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
 
   // Get a temporary directory for a file
   std::string aTmpDir = isMultiFile?theURL:SALOMEDS_Tool::GetTmpDir();
+
+  // OCCT BUG: cannot load a document (from current folder)
+  // if directory name is empty
+  if (aTmpDir.size() == 0) {
+#ifdef WNT
+    aTmpDir = ".\\";
+#else
+    aTmpDir = "./";
+#endif
+  }
+
   // Conver the byte stream theStream to a file and place it in tmp directory
-  SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir.c_str(), isMultiFile);
+  SALOMEDS::ListOfFileNames_var aSeq =
+    SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir.c_str(), isMultiFile);
 
   // Prepare a file name to open
   TCollection_AsciiString aNameWithExt("");