Skip to content

Commit 886f7ca

Browse files
committed
fix(SDK): when exporting, ignore folders named "node_modules"
1 parent cc88705 commit 886f7ca

File tree

1 file changed

+12
-1
lines changed
  • runner/src/main/java/com/codingame/gameengine/runner

1 file changed

+12
-1
lines changed

runner/src/main/java/com/codingame/gameengine/runner/Renderer.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,13 +612,24 @@ private Path exportSourceCode(Path sourceFolderPath, Path zipPath) throws IOExce
612612
@Override
613613
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
614614
String relativePath = sourceFolderPath.relativize(file).toString();
615-
if (relativePath.startsWith("config") || relativePath.startsWith("src") || relativePath.equals("pom.xml")) {
615+
616+
if (whiteListed(relativePath) && !blacklisted(relativePath)) {
616617
zos.putNextEntry(new ZipEntry(sourceFolderPath.relativize(file).toString().replace('\\', '/')));
617618
Files.copy(file, zos);
618619
zos.closeEntry();
619620
}
620621
return FileVisitResult.CONTINUE;
621622
}
623+
624+
private boolean blacklisted(String relativePath) {
625+
return relativePath.contains("/node_modules/");
626+
}
627+
628+
private boolean whiteListed(String relativePath) {
629+
return relativePath.startsWith("config")
630+
|| relativePath.startsWith("src")
631+
|| relativePath.equals("pom.xml");
632+
}
622633
}
623634
);
624635
}

0 commit comments

Comments
 (0)