since Eclipse Mars and the Oomph installer, the structure of eclipse on macs looks different. Installer updated to account for this.

This commit is contained in:
Reinier Zwitserloot committed 2015-03-31 00:32:43 +02:00
1 parent d831aabf6c
commit 7707140b6c
2 files changed
+23 -3

No files matched your search

@@ -49,6 +49,7 @@ import lombok.installer.UninstallException;
public class EclipseLocation extends IdeLocation {
private final String name;
private final File eclipseIniPath;
private final String pathToLombokJarPrefix;
private volatile boolean hasLombok;
private static final String OS_NEWLINE = IdeFinder.getOS().getLineEnding();
@@ -64,6 +65,15 @@ public class EclipseLocation extends IdeLocation {
EclipseLocation(String nameOfLocation, File pathToEclipseIni) throws CorruptedIdeLocationException {
this.name = nameOfLocation;
this.eclipseIniPath = pathToEclipseIni;
File p1 = pathToEclipseIni.getParentFile();
File p2 = p1 == null ? null : p1.getParentFile();
File p3 = p2 == null ? null : p2.getParentFile();
if (p1 != null && p1.getName().equals("Eclipse") && p2 != null && p2.getName().equals("Contents") && p3 != null && p3.getName().endsWith(".app")) {
this.pathToLombokJarPrefix = "../Eclipse/";
} else {
this.pathToLombokJarPrefix = "";
}
try {
this.hasLombok = checkForLombok(eclipseIniPath);
} catch (IOException e) {
@@ -333,10 +343,15 @@ public class EclipseLocation extends IdeLocation {
fis.close();
}
String fullPathToLombok = fullPathRequired ? (lombokJar.getParentFile().getCanonicalPath() + File.separator) : "";
String pathPrefix;
if (fullPathRequired) {
pathPrefix = lombokJar.getParentFile().getCanonicalPath() + File.separator;
} else {
pathPrefix = pathToLombokJarPrefix;
}
newContents.append(String.format(
"-javaagent:%s", escapePath(fullPathToLombok + "lombok.jar"))).append(OS_NEWLINE);
"-javaagent:%s", escapePath(pathPrefix + "lombok.jar"))).append(OS_NEWLINE);
FileOutputStream fos = new FileOutputStream(eclipseIniPath);
try {
@@ -104,11 +104,16 @@ public class EclipseLocationProvider implements IdeLocationProvider {
if (ini.isFile()) return makeLocation(canonical(exePath), ini);
}
/* Try looking for Eclipse/app/Contents/MacOS/eclipse.ini as sibling to executable; this works on Mac OS X. */ {
/* Try looking for Eclipse.app/Contents/MacOS/eclipse.ini as sibling to executable; this works on Mac OS X. */ {
File ini = new File(exePath.getParentFile(), getMacAppName() + "/Contents/MacOS/" + getIniName());
if (ini.isFile()) return makeLocation(canonical(exePath), ini);
}
/* Starting with Eclipse Mars (with the oomph installer), the structure has changed, and it's now at Eclipse.app/Contents/Eclipse/eclipse.ini*/ {
File ini = new File(exePath.getParentFile(), getMacAppName() + "/Contents/Eclipse/" + getIniName());
if (ini.isFile()) return makeLocation(canonical(exePath), ini);
}
/* If executable is a soft link, follow it and retry. */ {
if (loopCounter < 50) {
try {