From 2c616f7bcf8625f9f50e510a74c7c4e043983df3 Mon Sep 17 00:00:00 2001 From: tpietzsch Date: Wed, 17 Apr 2024 11:06:53 +0200 Subject: [PATCH] Make sure that the result FilePaths.findExe() is not a directory (this happened to me for /opt/homebrew/opt/java which was found but is a directory) --- src/main/java/org/apposed/appose/FilePaths.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apposed/appose/FilePaths.java b/src/main/java/org/apposed/appose/FilePaths.java index 7e31e08..e347119 100644 --- a/src/main/java/org/apposed/appose/FilePaths.java +++ b/src/main/java/org/apposed/appose/FilePaths.java @@ -72,7 +72,7 @@ public static File findExe(List dirs, List exes) { // Candidate is a relative path; check beneath each given directory. for (String dir : dirs) { File f = Paths.get(dir, exe).toFile(); - if (f.canExecute()) return f; + if (f.canExecute() && !f.isDirectory()) return f; } } }