@@ -390,16 +390,20 @@ private String getRoot(Map<String, ? super Object> params,
390
390
Path rootDir = appLocation .getParent () == null ?
391
391
Path .of ("." ) : appLocation .getParent ();
392
392
393
- Path [] list = Files .list (rootDir ).toArray (Path []::new );
394
- if (list != null ) { // Should not happend
395
- // We should only have app image and/or .DS_Store
396
- if (list .length == 1 ) {
397
- return rootDir .toString ();
398
- } else if (list .length == 2 ) {
399
- // Check case with app image and .DS_Store
400
- if (list [0 ].toString ().toLowerCase ().endsWith (".ds_store" ) ||
401
- list [1 ].toString ().toLowerCase ().endsWith (".ds_store" )) {
402
- return rootDir .toString (); // Only app image and .DS_Store
393
+ // Not needed for runtime installer and it might break runtime installer
394
+ // if parent does not have any other files
395
+ if (!StandardBundlerParam .isRuntimeInstaller (params )) {
396
+ try (var fileList = Files .list (rootDir )) {
397
+ Path [] list = fileList .toArray (Path []::new );
398
+ // We should only have app image and/or .DS_Store
399
+ if (list .length == 1 ) {
400
+ return rootDir .toString ();
401
+ } else if (list .length == 2 ) {
402
+ // Check case with app image and .DS_Store
403
+ if (list [0 ].toString ().toLowerCase ().endsWith (".ds_store" ) ||
404
+ list [1 ].toString ().toLowerCase ().endsWith (".ds_store" )) {
405
+ return rootDir .toString (); // Only app image and .DS_Store
406
+ }
403
407
}
404
408
}
405
409
}
0 commit comments