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
11 changes: 11 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 @@ -4,6 +4,7 @@
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.io.File;

import java.nio.file.DirectoryStream;
import java.nio.file.Files;
Expand Down Expand Up @@ -35,7 +36,17 @@ public static void main(String[] args) {
for (Path entry : ds) {
Job job = new Job(entry.toFile());
logger.info(String.format("Job %d yields %d\n", job.getInput(), job.processJob()));

// Delete the job file after it has been processed
Files.delete(entry);
// Log the deletion of the file
logger.info(String.format("The file for Job %d has been deleted\n", job.getInput()));
}

// Delete the directory after all jobs are processed.
Files.delete(dir);
logger.info(String.format("The directory containing the job files has been deleted."));

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