Skip to content

Commit

Permalink
Excluding automatic file removal
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaredstork committed Nov 2, 2023
1 parent 76d242e commit ea6c725
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 33 deletions.
16 changes: 0 additions & 16 deletions src/libs/antares/study/study.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1541,21 +1541,5 @@ void Study::computePThetaInfForThermalClusters() const
}
}
}

void Study::deleteDeprecatedFiles(uint previousVersion)
{
if (previousVersion < 870)
{
const std::string filePath(folderInput + "/hydro/common/capacity/");
areas.each(
[&filePath](const Area& area)
{
const std::string fileName(filePath + "maxpower_" + area.id + ".txt");
if (bool exist = IO::File::Exists(fileName); exist)
IO::File::Delete(fileName);
});
}
}

} // namespace Antares::Data

6 changes: 0 additions & 6 deletions src/libs/antares/study/study.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,6 @@ class Study: public Yuni::NonCopyable<Study>, public IObject, public LayerData
void removeTimeseriesIfTSGeneratorEnabled();
//@}

/*!
** \brief Delete deprecated files when upgrading a study
*/
void deleteDeprecatedFiles(uint previousVersion);
//@}

//! \name
//@{
/*!
Expand Down
7 changes: 1 addition & 6 deletions src/tools/updater/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,7 @@ class MyStudyFinder final : public Data::StudyFinder
study->parameters.readonly = true;

logs.info() << "Saving...";

uint tempVersionVar = (uint)study->header.version;
bool isSaved = study->saveToFolder(folder);

if (isSaved && (tempVersionVar != Antares::Data::versionLatest))
study->deleteDeprecatedFiles(tempVersionVar);
study->saveToFolder(folder);
}
else
{
Expand Down
6 changes: 1 addition & 5 deletions src/ui/simulator/application/study.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,7 @@ class JobSaveStudy final : public Toolbox::Jobs::Job
} // save as

// Save the study (only changes in the most cases)
uint tempVersionVar = study->header.version;
bool isSaved = study->saveToFolder(pFolder);

if (isSaved && (tempVersionVar != Antares::Data::versionLatest))
study->deleteDeprecatedFiles(tempVersionVar);
study->saveToFolder(pFolder);

// Scenario Builder
if (pCanReleaseScenarioBuilder && study->scenarioRules)
Expand Down

0 comments on commit ea6c725

Please sign in to comment.