8267056: tools/jpackage/share/RuntimePackageTest.java fails with NoSuchFileException
Reviewed-by: asemenyuk, herrick
This commit is contained in:
parent
e094f3f856
commit
9eaa4afc99
@ -390,16 +390,20 @@ public class MacPkgBundler extends MacBaseInstallerBundler {
|
||||
Path rootDir = appLocation.getParent() == null ?
|
||||
Path.of(".") : appLocation.getParent();
|
||||
|
||||
Path[] list = Files.list(rootDir).toArray(Path[]::new);
|
||||
if (list != null) { // Should not happend
|
||||
// We should only have app image and/or .DS_Store
|
||||
if (list.length == 1) {
|
||||
return rootDir.toString();
|
||||
} else if (list.length == 2) {
|
||||
// Check case with app image and .DS_Store
|
||||
if (list[0].toString().toLowerCase().endsWith(".ds_store") ||
|
||||
list[1].toString().toLowerCase().endsWith(".ds_store")) {
|
||||
return rootDir.toString(); // Only app image and .DS_Store
|
||||
// Not needed for runtime installer and it might break runtime installer
|
||||
// if parent does not have any other files
|
||||
if (!StandardBundlerParam.isRuntimeInstaller(params)) {
|
||||
try (var fileList = Files.list(rootDir)) {
|
||||
Path[] list = fileList.toArray(Path[]::new);
|
||||
// We should only have app image and/or .DS_Store
|
||||
if (list.length == 1) {
|
||||
return rootDir.toString();
|
||||
} else if (list.length == 2) {
|
||||
// Check case with app image and .DS_Store
|
||||
if (list[0].toString().toLowerCase().endsWith(".ds_store") ||
|
||||
list[1].toString().toLowerCase().endsWith(".ds_store")) {
|
||||
return rootDir.toString(); // Only app image and .DS_Store
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,6 +151,7 @@ public class RuntimePackageTest {
|
||||
final Path prefsDir = Path.of(".systemPrefs");
|
||||
return files.map(root::relativize)
|
||||
.filter(x -> !x.startsWith(prefsDir))
|
||||
.filter(x -> !x.endsWith(".DS_Store"))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user