@@ -442,7 +442,9 @@ public Path isFile() {
442
442
if (path == null ) {
443
443
throw new IllegalStateException (String .format (MUST_BE_SET , name ));
444
444
}
445
- if (!Files .exists (path )) {
445
+ // notExists returns false in case it is impossible to determinate the exact result of a link
446
+ // target e.g. Windows app execution aliases
447
+ if (Files .notExists (path )) {
446
448
throw new IllegalStateException (String .format (MUST_EXIST , name , path ));
447
449
}
448
450
if (!Files .isRegularFile (path )) {
@@ -455,7 +457,9 @@ public Path isDirectory() {
455
457
if (path == null ) {
456
458
throw new IllegalStateException (String .format (MUST_BE_SET , name ));
457
459
}
458
- if (!Files .exists (path )) {
460
+ // notExists returns false in case it is impossible to determinate the exact result of a link
461
+ // target e.g. Windows app execution aliases
462
+ if (Files .notExists (path )) {
459
463
throw new IllegalStateException (String .format (MUST_EXIST , name , path ));
460
464
}
461
465
if (!Files .isDirectory (path )) {
@@ -468,7 +472,9 @@ public Path isExecutable() {
468
472
if (path == null ) {
469
473
throw new IllegalStateException (String .format (MUST_BE_SET , name ));
470
474
}
471
- if (!Files .exists (path )) {
475
+ // notExists returns false in case it is impossible to determinate the exact result of a link
476
+ // target e.g. Windows app execution aliases
477
+ if (Files .notExists (path )) {
472
478
throw new IllegalStateException (String .format (MUST_EXIST , name , path ));
473
479
}
474
480
// do not check for isRegularFile here, there are executable none regular files e.g. Windows
0 commit comments