1818import java .util .Collections ;
1919import java .util .Comparator ;
2020import java .util .List ;
21+ import java .util .stream .Collectors ;
2122import java .util .stream .Stream ;
2223
2324import com .dumptruckman .minecraft .util .Logging ;
2425import io .vavr .control .Try ;
2526import jakarta .inject .Inject ;
2627import org .jetbrains .annotations .NotNull ;
2728import org .jetbrains .annotations .Nullable ;
29+ import org .jspecify .annotations .NonNull ;
2830import org .jvnet .hk2 .annotations .Service ;
2931import org .mvplugins .multiverse .core .config .CoreConfig ;
3032
@@ -210,16 +212,19 @@ private static final class CopyDirFileVisitor extends SimpleFileVisitor<Path> {
210212
211213 private final Path sourceDir ;
212214 private final Path targetDir ;
213- private final List <String > excludeFiles ;
215+ private final List <Path > excludeFiles ;
214216
215217 private CopyDirFileVisitor (@ NotNull Path sourceDir , @ NotNull Path targetDir , @ NotNull List <String > excludeFiles ) {
216218 this .sourceDir = sourceDir ;
217219 this .targetDir = targetDir ;
218- this .excludeFiles = excludeFiles ;
220+ this .excludeFiles = excludeFiles .stream ()
221+ .map (sourceDir ::resolve )
222+ .toList ();
223+ Logging .finest (this .excludeFiles .stream ().map (Path ::toString ).collect (Collectors .joining (", " , "Exclude files: [" , "]" )));
219224 }
220225
221226 @ Override
222- public @ NotNull FileVisitResult preVisitDirectory (Path dir , @ NotNull BasicFileAttributes attrs ) throws IOException {
227+ public @ NotNull FileVisitResult preVisitDirectory (@ NonNull Path dir , @ NotNull BasicFileAttributes attrs ) throws IOException {
223228 Path newDir = targetDir .resolve (sourceDir .relativize (dir ));
224229 if (!Files .isDirectory (newDir )) {
225230 Files .createDirectory (newDir );
@@ -228,10 +233,10 @@ private CopyDirFileVisitor(@NotNull Path sourceDir, @NotNull Path targetDir, @No
228233 }
229234
230235 @ Override
231- public @ NotNull FileVisitResult visitFile (Path file , @ NotNull BasicFileAttributes attrs ) throws IOException {
236+ public @ NotNull FileVisitResult visitFile (@ NonNull Path file , @ NotNull BasicFileAttributes attrs ) throws IOException {
232237 // Pass files that are set to ignore
233- if (excludeFiles .contains (file . getFileName (). toString () )) {
234- Logging .finest ("Ignoring file: " + file . getFileName () );
238+ if (excludeFiles .contains (file )) {
239+ Logging .finest ("Ignoring file: " + file );
235240 return FileVisitResult .CONTINUE ;
236241 }
237242 // Copy the files
0 commit comments