Skip to content

Commit

Permalink
In the reports archive Skipping now the reports from plots.
Browse files Browse the repository at this point in the history
  • Loading branch information
danv61 committed Sep 19, 2021
1 parent 332d34f commit 2e9f112
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions vcell-cli/src/main/java/org/vcell/cli/CLIUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import cbit.vcell.solver.ode.ODESolverResultSet;
import cbit.vcell.util.ColumnDescription;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.jlibsedml.*;
Expand Down Expand Up @@ -694,6 +695,13 @@ public static void zipResFiles(File dirPath) throws IOException {
put("csv", "reports.zip");
put("pdf", "plots.zip");
}};

Set<String> filesToSkip = new HashSet<>();
srcFiles = listFilesForFolder(dirPath, "pdf");
for(File file : srcFiles) {
String baseName = FilenameUtils.getBaseName(file.getName());
filesToSkip.add(baseName);
}

for (String ext : extensionListMap.keySet()) {
srcFiles = listFilesForFolder(dirPath, ext);
Expand All @@ -705,6 +713,13 @@ public static void zipResFiles(File dirPath) throws IOException {
zipOutputStream = new ZipOutputStream(fileOutputStream);
if (srcFiles.size() != 0) System.out.println("Archiving resultant " + ext.toUpperCase() + " files to `" + extensionListMap.get(ext) + "`.");
for (File srcFile : srcFiles) {

if("csv".equalsIgnoreCase(ext)) {
String candidate = FilenameUtils.getBaseName(srcFile.getName());
if(filesToSkip.contains(candidate)) {
continue; // skip reports with a corresponding (same name) image
}
}

fileInputstream = new FileInputStream(srcFile);

Expand Down

0 comments on commit 2e9f112

Please sign in to comment.