Skip to content

Commit

Permalink
Update clean (#598)
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas Bittar <[email protected]>
  • Loading branch information
tbittar and tbittar authored Jan 16, 2023
1 parent 64d878d commit 0f1bb54
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/cpp/helpers/AntaresArchiveUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
const std::string CRITERION_FILES_PREFIX = "criterion";
const std::string CONSTRAINTS_FILES_PREFIX = "constraints";
const std::string VARIABLES_FILES_PREFIX = "variables";
const std::string INTERCO_FILES_PREFIX = "interco";
const std::string AREA_FILES_PREFIX = "area";
const std::string MPS_FILES_EXTENSION = ".mps";

bool isCriterionFile(const std::filesystem::path &file_name) {
Expand All @@ -26,6 +28,18 @@ bool isConstraintsFile(const std::filesystem::path &file_name) {
!file_name.has_root_path();
}

bool isAreaFile(const std::filesystem::path &file_name) {
auto file_name_str = file_name.string();
return StringUtils::contains(file_name_str, AREA_FILES_PREFIX) &&
!file_name.has_root_path();
}

bool isIntercoFile(const std::filesystem::path &file_name) {
auto file_name_str = file_name.string();
return StringUtils::contains(file_name_str, INTERCO_FILES_PREFIX) &&
!file_name.has_root_path();
}

bool IsAntaresMpsFile(const std::filesystem::path &file_name) {
return file_name.filename().extension() == MPS_FILES_EXTENSION &&
!file_name.has_parent_path();
Expand Down Expand Up @@ -54,7 +68,7 @@ int32_t AntaresArchiveUpdater::MinizipErase(void *reader, void *writer) {
except the ones we don't want */
auto file_name = std::filesystem::path(file_info->filename);
if (!isCriterionFile(file_name) && !isConstraintsFile(file_name) &&
!isVariablesFile(file_name) && !IsAntaresMpsFile(file_name)) {
!isVariablesFile(file_name) && !isAreaFile(file_name) && !isIntercoFile(file_name) && !IsAntaresMpsFile(file_name)) {
err = mz_zip_writer_copy_from_reader(writer, reader);

if (err != MZ_OK) {
Expand Down

0 comments on commit 0f1bb54

Please sign in to comment.