From 6a1368981060fe0cdc4f067b007823400e32df7a Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 8 Feb 2007 11:22:58 +0000 Subject: [PATCH] NPAL14828: Impossible to load a study created in batch mode. Use './' instead of empty path for OCCT correct work. --- src/GEOM_I/GEOM_Gen_i.cc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 26b9b7747..a5e9c2e54 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -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(""); -- 2.39.2