+ LightApp_DataModel::open( thePath, theStudy, theFiles );
+ if (theFiles.size() == 0)
+ return false;
+
+ myStudyPath = thePath;
+
+ // If the file is Multi(contain all module files inside), the open SALOME functionality creates
+ // these files in a temporary directory. After the open functionality is finished, it removes
+ // these files (in the full SALOME mode).
+ // The postponed loading of the files is realized in the NewGEOM module. So, it is important do
+ // not remove the opened files.
+ // The following code creates a new tmp directory with a copy of files.
+ QString aTmpDir = theFiles.first();
+
+ LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( myModule->application()->activeStudy() );
+ QString aNewTmpDir = aStudy->GetTmpDir("", false).c_str();
+
+ bool isDone = true;
+ QDir aDir(aTmpDir);
+ QStringList aFiles = aDir.entryList(QDir::Files);
+ QStringList::const_iterator anIt = aFiles.begin(), aLast = aFiles.end();
+ for (; anIt != aLast; anIt++) {
+ QString aFileName = *anIt;
+
+ QString aCurrentFile = SUIT_Tools::addSlash(aTmpDir) + aFileName;
+ QString aNewFile = SUIT_Tools::addSlash(aNewTmpDir) + aFileName;
+ if (!QFile::copy(aCurrentFile, aNewFile))
+ isDone = false;
+ }
+ if (isDone) {
+ myTmpDirectory = aNewTmpDir;
+ }
+ else {
+ removeDirectory(aNewTmpDir);
+ myTmpDirectory = "";
+ }
+
+ SessionPtr aMgr = ModelAPI_Session::get();
+ aMgr->load(qPrintable(aNewTmpDir));
+ myModule->setIsOpened(true);