+ SetListOfFiles( 0, names ); // 0 means persistence file
+ manuallySaved = true;
+ }
+
+ // Get a temporary directory to store a file
+ //std::string aTmpDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
+
+ // listOfFiles must contain temporary directory name in its first item
+ // and names of files (relatively the temporary directory) in the others
+ ListOfFiles listOfFiles = GetListOfFiles( 0 ); // 0 means persistence file
+ const int n = (int)listOfFiles.size() - 1; //!< TODO: conversion from size_t to int
+
+ if (n > 0) { // there are some files, containing persistent data of the component
+ std::string aTmpDir = listOfFiles[0];
+
+ // Create a list to store names of created files
+ ListOfFiles aSeq;
+ aSeq.reserve(n);
+ for (int i = 0; i < n; i++)
+ aSeq.push_back(CORBA::string_dup(listOfFiles[i + 1].c_str()));
+
+ // Convert a file to the byte stream
+ aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq, isMultiFile);
+
+ // Remove the files and tmp directory, created by the component storage procedure
+ SalomeApp_Application* app =
+ dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ study->RemoveTemporaryFiles( myComponentName.toStdString().c_str(), isMultiFile );