|
22 | 22 | import java.nio.file.Path; |
23 | 23 | import java.util.Enumeration; |
24 | 24 | import java.util.Set; |
25 | | -import java.util.zip.ZipEntry; |
26 | 25 |
|
27 | 26 | public final class StudentFileAwareUnzipper implements Unzipper { |
28 | 27 |
|
@@ -121,23 +120,23 @@ public UnzipResult unzip(Path zip, Path target) throws IOException { |
121 | 120 | } |
122 | 121 |
|
123 | 122 | log.debug("Done unzipping"); |
124 | | - deleteFilesNotInZip(target, target, result, pathsInZip); |
| 123 | + deleteFilesNotInZip(target, result, pathsInZip); |
125 | 124 | return null; |
126 | 125 | } |
127 | 126 |
|
128 | 127 | // TODO: validate |
129 | 128 | private void deleteFilesNotInZip( |
130 | | - Path projectDir, Path curDir, UnzipResult result, Set<Path> pathsInZip) |
| 129 | + Path projectDir, UnzipResult result, Set<Path> pathsInZip) |
131 | 130 | throws IOException { |
132 | 131 |
|
133 | | - for (File file : curDir.toFile().listFiles()) { |
| 132 | + for (File file : projectDir.toFile().listFiles()) { |
134 | 133 | Path filePath = file.toPath(); |
135 | 134 | if (file.isDirectory()) { |
136 | | - deleteFilesNotInZip(projectDir, file.toPath(), result, pathsInZip); |
| 135 | + deleteFilesNotInZip(file.toPath(), result, pathsInZip); |
137 | 136 | } |
138 | 137 |
|
139 | 138 | if (!pathsInZip.contains(filePath)) { |
140 | | - if (mayDelete(filePath, null)) { |
| 139 | + if (mayDelete(filePath, projectDir)) { |
141 | 140 | if (file.isDirectory() && file.listFiles().length > 0) { |
142 | 141 | // Won't delete directories if they still have contents |
143 | 142 | result.skippedDeletingFiles.add(filePath); |
|
0 commit comments