Modify path
This commit is contained in:
@@ -5,7 +5,8 @@
|
|||||||
"Bash(echo:*)",
|
"Bash(echo:*)",
|
||||||
"Bash(gradle wrapper:*)",
|
"Bash(gradle wrapper:*)",
|
||||||
"Bash(./gradlew build:*)",
|
"Bash(./gradlew build:*)",
|
||||||
"Bash(./gradlew clean build:*)"
|
"Bash(./gradlew clean build:*)",
|
||||||
|
"Bash(jar:*)"
|
||||||
],
|
],
|
||||||
"deny": [],
|
"deny": [],
|
||||||
"ask": []
|
"ask": []
|
||||||
|
|||||||
@@ -199,24 +199,25 @@ public class CfCliService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String os = getOperatingSystem();
|
String os = getOperatingSystem();
|
||||||
String executable = os.equals("windows") ? "cf.exe" : "cf";
|
// CF CLI v8 uses cf8/cf8.exe as the executable name
|
||||||
|
String executable = os.equals("windows") ? "cf8.exe" : "cf8";
|
||||||
|
|
||||||
log.info("Detected operating system: {}", os);
|
log.info("Detected operating system: {}", os);
|
||||||
log.debug("CF CLI executable name: {}", executable);
|
log.info("CF CLI executable name: {}", executable);
|
||||||
|
|
||||||
String resourcePath = String.format("/cf-cli/%s/%s", os, executable);
|
String resourcePath = String.format("/cf-cli/%s/%s", os, executable);
|
||||||
File tempFile = File.createTempFile("cf-cli-", os.equals("windows") ? ".exe" : "");
|
File tempFile = File.createTempFile("cf-cli-", os.equals("windows") ? ".exe" : "");
|
||||||
tempFile.deleteOnExit();
|
tempFile.deleteOnExit();
|
||||||
|
|
||||||
log.debug("Extracting CF CLI from resource path: {}", resourcePath);
|
log.info("Extracting CF CLI from resource path: {}", resourcePath);
|
||||||
|
|
||||||
try (var inputStream = getClass().getResourceAsStream(resourcePath)) {
|
try (var inputStream = getClass().getResourceAsStream(resourcePath)) {
|
||||||
if (inputStream == null) {
|
if (inputStream == null) {
|
||||||
log.error("CF CLI binary not found in resources for OS: {}. Expected path: {}", os, resourcePath);
|
log.error("CF CLI binary not found in resources for OS: {}. Expected path: {}", os, resourcePath);
|
||||||
throw new IOException("CF CLI binary not found for OS: " + os + " at path: " + resourcePath);
|
throw new IOException("CF CLI binary not found for OS: " + os + " at path: " + resourcePath);
|
||||||
}
|
}
|
||||||
Files.copy(inputStream, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
long bytesCopied = Files.copy(inputStream, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
log.debug("CF CLI extracted to temporary file: {}", tempFile.getAbsolutePath());
|
log.info("CF CLI extracted to temporary file: {} ({} bytes)", tempFile.getAbsolutePath(), bytesCopied);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!os.equals("windows")) {
|
if (!os.equals("windows")) {
|
||||||
@@ -225,10 +226,10 @@ public class CfCliService {
|
|||||||
perms.add(PosixFilePermission.OWNER_WRITE);
|
perms.add(PosixFilePermission.OWNER_WRITE);
|
||||||
perms.add(PosixFilePermission.OWNER_EXECUTE);
|
perms.add(PosixFilePermission.OWNER_EXECUTE);
|
||||||
Files.setPosixFilePermissions(tempFile.toPath(), perms);
|
Files.setPosixFilePermissions(tempFile.toPath(), perms);
|
||||||
log.debug("Set executable permissions on CF CLI binary");
|
log.info("Set executable permissions on CF CLI binary");
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Using CF CLI executable: {}", tempFile.getAbsolutePath());
|
log.info("Successfully prepared CF CLI executable: {}", tempFile.getAbsolutePath());
|
||||||
return tempFile.getAbsolutePath();
|
return tempFile.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user