forked from openshift/jenkins-client-plugin
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`FindOc` uses `Path.walkFileTree()` to visit all directories (and their subdirectories) in `PATH`. However, there are 2 problems: 1. My development computer is Mac, where `oc` is installed with HomeBrew. The `oc` is located at `/usr/local/bin/oc`, which is a symlink to `../Cellar/openshift-cli/3.11.0/bin/oc`. However, by default `Path.walkFileTree()` doesn't follow symlinks. When it visits `/usr/local/bin/oc`, `attr.isRegularFile()` returns `false`, so `oc` is not discovered. Using normal `File.canExecute()` API just works fine because it follows symlink. 2. Visiting subdirectories doesn't seem to be needed. Rather than work through the file tree, this PR just concatenates the each directory in `PATH` and `ocFileName` then checks if resulting location is an executable file.
- Loading branch information
1 parent
1926fe4
commit 394ba97
Showing
2 changed files
with
17 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters