From 36e41ebcf3d8293366d74e6a43b931ca01d2c569 Mon Sep 17 00:00:00 2001 From: ascopes <73482956+ascopes@users.noreply.github.com> Date: Mon, 23 Oct 2023 08:13:16 +0100 Subject: [PATCH] Update PathProtocResolver.java to ignore executable bit on Windows --- .../protobufmavenplugin/resolver/PathProtocResolver.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/ascopes/protobufmavenplugin/resolver/PathProtocResolver.java b/src/main/java/io/github/ascopes/protobufmavenplugin/resolver/PathProtocResolver.java index f7661db2..60477eaf 100644 --- a/src/main/java/io/github/ascopes/protobufmavenplugin/resolver/PathProtocResolver.java +++ b/src/main/java/io/github/ascopes/protobufmavenplugin/resolver/PathProtocResolver.java @@ -65,7 +65,7 @@ public Path resolveProtoc() throws ProtocResolutionException { try (var fileStream = Files.list(indexableDirectory)) { var result = fileStream - .filter(Files::isExecutable) + .filter(this::isExecutable) .filter(this::isProtoc) .findFirst(); @@ -83,6 +83,11 @@ public Path resolveProtoc() throws ProtocResolutionException { } } + private boolean isExecutable(Path path) { + // TODO(ascopes): Verify this is the correct logic... + return HostEnvironment.isWindows() || Files.isExecutable(path); + } + private boolean isProtoc(Path path) { var fileName = path.getFileName().toString();