Allow CF CLI config check on all OS

This commit is contained in:
nsingh
2017-01-23 13:21:53 -08:00
parent eb6afc8b98
commit 26544461b8

View File

@@ -86,24 +86,21 @@ public class CfCliParamsProvider implements ClientParamsProvider {
}
private File getConfigJsonFile() throws IOException, InterruptedException {
// Support Unix systems for now
if (!System.getProperty("os.name").toLowerCase().startsWith("win")) {
String homeDir = getUnixHomeDir();
if (homeDir != null) {
if (!homeDir.endsWith("/")) {
homeDir += '/';
}
String filePath = homeDir + ".cf/config.json";
File file = new File(filePath);
if (file.exists() && file.canRead()) {
return file;
}
String homeDir = getHomeDir();
if (homeDir != null) {
if (!homeDir.endsWith("/")) {
homeDir += '/';
}
String filePath = homeDir + ".cf/config.json";
File file = new File(filePath);
if (file.exists() && file.canRead()) {
return file;
}
}
return null;
}
private String getUnixHomeDir() throws IOException, InterruptedException {
private String getHomeDir() throws IOException, InterruptedException {
return System.getProperty("user.home");
}