Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not require source directory of bitstreams #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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