Skip to content

Commit 136b6db

Browse files
committed
only delete the src/ folder if it was empty
1 parent f3f7a89 commit 136b6db

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,13 @@ public int run() throws IOException {
452452
} else {
453453
warn("No JavaScript or TypeScript code found.");
454454
}
455-
// ensuring that the finalize steps detects that no code was seen
456-
FileUtil8.recursiveDelete(Paths.get(EnvironmentVariables.getWipDatabase() + "/src"));
455+
// ensuring that the finalize steps detects that no code was seen.
456+
Path srcFolder = Paths.get(EnvironmentVariables.getWipDatabase() + "/src");
457+
// check that the srcFolder is empty
458+
if (Files.list(srcFolder).count() == 0) {
459+
// Non-recursive delete because "src/" should be empty.
460+
FileUtil8.delete(srcFolder);
461+
}
457462
return 0;
458463
}
459464
return 0;

0 commit comments

Comments
 (0)