Modify path
This commit is contained in:
@@ -199,24 +199,25 @@ public class CfCliService {
|
||||
}
|
||||
|
||||
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.debug("CF CLI executable name: {}", executable);
|
||||
log.info("CF CLI executable name: {}", executable);
|
||||
|
||||
String resourcePath = String.format("/cf-cli/%s/%s", os, executable);
|
||||
File tempFile = File.createTempFile("cf-cli-", os.equals("windows") ? ".exe" : "");
|
||||
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)) {
|
||||
if (inputStream == null) {
|
||||
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);
|
||||
}
|
||||
Files.copy(inputStream, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
log.debug("CF CLI extracted to temporary file: {}", tempFile.getAbsolutePath());
|
||||
long bytesCopied = Files.copy(inputStream, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
log.info("CF CLI extracted to temporary file: {} ({} bytes)", tempFile.getAbsolutePath(), bytesCopied);
|
||||
}
|
||||
|
||||
if (!os.equals("windows")) {
|
||||
@@ -225,10 +226,10 @@ public class CfCliService {
|
||||
perms.add(PosixFilePermission.OWNER_WRITE);
|
||||
perms.add(PosixFilePermission.OWNER_EXECUTE);
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user