Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/test/java/com/github/copilot/sdk/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public static String tempPath(String filename) {
* <p>
* Resolution order:
* <ol>
* <li>Search the system PATH using {@code where.exe} (Windows) or {@code which}
* (Linux/macOS).</li>
* <li>Fall back to the {@code COPILOT_CLI_PATH} environment variable.</li>
* <li>Use the {@code COPILOT_CLI_PATH} environment variable when set.</li>
* <li>Otherwise search the system PATH using {@code where.exe} (Windows) or
* {@code which} (Linux/macOS).</li>
* <li>Walk parent directories looking for
* {@code nodejs/node_modules/@github/copilot/index.js}.</li>
* </ol>
Expand All @@ -55,16 +55,16 @@ public static String tempPath(String filename) {
* {@code null} if none was found
*/
static String findCliPath() {
String copilotInPath = findCopilotInPath();
if (copilotInPath != null) {
return copilotInPath;
}

String envPath = System.getenv("COPILOT_CLI_PATH");
if (envPath != null && !envPath.isEmpty()) {
return envPath;
}

String copilotInPath = findCopilotInPath();
if (copilotInPath != null) {
return copilotInPath;
}

Path current = Paths.get(System.getProperty("user.dir"));
while (current != null) {
Path cliPath = current.resolve("nodejs/node_modules/@github/copilot/index.js");
Expand Down
Loading