Skip to content
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
15 changes: 15 additions & 0 deletions java/src/main/java/ca/uwaterloo/cs489/exercise2/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,26 @@ public static void main(String[] args) {
Path dir = getDirectory();
DirectoryStream<Path> ds = Files.newDirectoryStream(dir);

// Iterate over all of the files in the directory, creating a job for each
// Iterate over all of the files in the directory, creating a job for each
for (Path entry : ds) {
Job job = new Job(entry.toFile());
logger.info(String.format("Job %d yields %d\n", job.getInput(), job.processJob()));
File myObj = new File(entry.toString());
// remove the job file when done
if (myObj.delete()) {
logger.info("Removed job file " + entry.toString());
} else {
logger.info("Failed to remove job file " + entry.toString());
}

}

// Delete directory
File dirObj = new File(dir.toString());
dirObj.delete();
logger.info("Deleting the temporary directory");

} catch (IOException e) {
e.printStackTrace();
}
Expand Down