Fix FileSystemUtils for Windows/Linux path difference

See gh-35443
This commit is contained in:
Juergen Hoeller
2025-09-08 17:51:58 +02:00
parent ba52164373
commit 9ba954c330
@@ -84,7 +84,11 @@ class FileSystemUtilsTests {
assertThat(new File(dest, "child")).exists();
assertThat(new File(dest, "child/bar.txt")).exists();
URI uri = URI.create("jar:file:/" + dest.toString().replace('\\', '/') + "/archive.zip");
String destPath = dest.toString().replace('\\', '/');
if (!destPath.startsWith("/")) {
destPath = "/" + destPath;
}
URI uri = URI.create("jar:file:" + destPath + "/archive.zip");
Map<String, String> env = Map.of("create", "true");
FileSystem zipfs = FileSystems.newFileSystem(uri, env);
Path ziproot = zipfs.getPath("/");