Skip to content
Open
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
22 changes: 19 additions & 3 deletions cli/src/main/java/dev/starfix/Starfix.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,25 @@ void defaultConfig() {
}
}
}

// check if Mac OS
// if(isMac()){}

else if (isMac()) { // check if Mac OS
if (isCommandAvailable("code")) { // If VSCode is installed
ide = "code";
} else if (isCommandAvailable("idea")) { // If IntelliJ is installed
ide = "idea";
} else if (new File("/Applications/Eclipse.app").exists()) { // If Eclipse is installed in default location
ide = "eclipse";
}
}
}
private static boolean isCommandAvailable(String command) {
try {
Process process = Runtime.getRuntime().exec("which " + command);
return process.waitFor() == 0;
} catch (IOException | InterruptedException e) {
e.printStackTrace();
return false;
}
}
// Function to edit configuration and serves for command line starfix config
// editor
Expand Down