X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FNewGeom%2FNewGeom_DataModel.cpp;h=88e7db728e938d5396200949082ac24b0b026ab3;hb=1dac8a1588cedf3252864550fbfe931a354b6b45;hp=34922cbbd197263842944d1a4d8271b0e54459fb;hpb=04bd01d1bc4084ad3e3ca3dc7268d2b16621aeac;p=modules%2Fshaper.git diff --git a/src/NewGeom/NewGeom_DataModel.cpp b/src/NewGeom/NewGeom_DataModel.cpp index 34922cbbd..88e7db728 100644 --- a/src/NewGeom/NewGeom_DataModel.cpp +++ b/src/NewGeom/NewGeom_DataModel.cpp @@ -40,8 +40,6 @@ bool NewGeom_DataModel::open(const QString& thePath, CAM_Study* theStudy, QStrin // The following code creates a new tmp directory with a copy of files. QString aTmpDir = theFiles.first(); - //LightApp_Driver aDriver; - //QString aNewTmpDir = QString(aDriver.GetTmpDir("", false).c_str()); LightApp_Study* aStudy = dynamic_cast( myModule->application()->activeStudy() ); QString aNewTmpDir = aStudy->GetTmpDir("", false).c_str(); @@ -57,6 +55,13 @@ bool NewGeom_DataModel::open(const QString& thePath, CAM_Study* theStudy, QStrin if (!QFile::copy(aCurrentFile, aNewFile)) isDone = false; } + if (isDone) { + myTmpDirectory = aNewTmpDir; + } + else { + removeDirectory(aNewTmpDir); + myTmpDirectory = ""; + } SessionPtr aMgr = ModelAPI_Session::get(); aMgr->load(qPrintable(aNewTmpDir)); @@ -103,6 +108,8 @@ bool NewGeom_DataModel::saveAs(const QString& thePath, CAM_Study* theStudy, QStr bool NewGeom_DataModel::close() { myModule->workshop()->closeDocument(); + removeDirectory(myTmpDirectory); + myTmpDirectory = ""; return LightApp_DataModel::close(); } @@ -125,3 +132,9 @@ bool NewGeom_DataModel::isSaved() const void NewGeom_DataModel::update(LightApp_DataObject* theObj, LightApp_Study* theStudy) { } + +void NewGeom_DataModel::removeDirectory(const QString& theDirectoryName) +{ + Qtx::rmDir(theDirectoryName); +} +