Skip to content

Commit

Permalink
[WFGP] Use the native FS path as the moduleTemplates map key, not the…
Browse files Browse the repository at this point in the history
… source path

The source path may come from ZipFileSystem and might not use the same separator char as the native FS file where the module template is stored
  • Loading branch information
bstansberry committed Oct 31, 2023
1 parent ffec067 commit 18a2ad3
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,10 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException {
if (WfConstants.MODULE_XML.equals(file.getFileName().toString())) {
final String relativePath = source.relativize(file).toString();
moduleTemplates.put(relativePath, fpArtifacts);
Files.copy(file, moduleTemplatesDir.resolve(relativePath), StandardCopyOption.REPLACE_EXISTING);
Path nativeCopy = Files.copy(file, moduleTemplatesDir.resolve(relativePath), StandardCopyOption.REPLACE_EXISTING);
// Use the native FS path as the map key, not the source path, which may be from ZipFileSystem
// and won't match the path of the actual template file we just wrote
moduleTemplates.put(moduleTemplatesDir.relativize(nativeCopy).toString(), fpArtifacts);
} else {
final Path target = wildflyHome.resolve(MODULES).resolve(source.relativize(file).toString());
Files.createDirectories(target.getParent());
Expand Down

0 comments on commit 18a2ad3

Please sign in to comment.