Skip to content

Commit

Permalink
Proceed without valid source directory
Browse files Browse the repository at this point in the history
  • Loading branch information
wwelling committed Apr 2, 2024
1 parent 59b85e9 commit 7c6ff89
Showing 1 changed file with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,8 @@ public boolean isCancelled() {

@Override
public Batch loadBatch(String metadataInputFileName, String sourceDirectoryName, String outputDirectoryName, JTextArea console) {
File sourceDirFileForChecking = new File(sourceDirectoryName);
File outputDirFileForChecking = new File(outputDirectoryName);

if (!(sourceDirFileForChecking.exists() && sourceDirFileForChecking.isDirectory())) {
console.append("\tERROR: Source file directory " + sourceDirectoryName + " is not a readable directory.\n");
return null;
}

if (!(outputDirFileForChecking.exists() && outputDirFileForChecking.isDirectory())) {
console.append("\tERROR: Designated SAF output directory " + outputDirectoryName + " is not an available directory.\n");
return null;
Expand Down Expand Up @@ -123,7 +117,23 @@ public Batch loadBatch(String metadataInputFileName, String sourceDirectoryName,

Batch batch = new Batch();
boolean errorState = false;
batch.setinputFilesDir(sourceDirectoryName);

boolean validSourceDir = false;

// check if source directory input provided and is a valid directory
if (sourceDirectoryName != null && sourceDirectoryName.length() > 0) {
File sourceDirFileForChecking = new File(sourceDirectoryName);
if (sourceDirFileForChecking.exists() && sourceDirFileForChecking.isDirectory()) {
batch.setinputFilesDir(sourceDirectoryName);
validSourceDir = true;
}
}

// only warn when no source directory is available
if (!validSourceDir) {
console.append("\tWARN: Source file directory " + sourceDirectoryName + " is not a readable directory.\n");
}

batch.setOutputSAFDir(outputDirectoryName);
List<ColumnLabel> columnLabels = new ArrayList<ColumnLabel>();
CSVReader reader = null;
Expand Down

0 comments on commit 7c6ff89

Please sign in to comment.