aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2015-03-31 00:32:43 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-03-31 00:32:43 +0200
commit7707140b6c86bd34801f3fd29092be06e2cee3cf (patch)
tree4163863ea3453b64f3c68b0c9fdb168b65b41853 /src
parentd831aabf6cf04a793792fec712912e31d537d4c9 (diff)
downloadlombok-7707140b6c86bd34801f3fd29092be06e2cee3cf.tar.gz
lombok-7707140b6c86bd34801f3fd29092be06e2cee3cf.tar.bz2
lombok-7707140b6c86bd34801f3fd29092be06e2cee3cf.zip
since Eclipse Mars and the Oomph installer, the structure of eclipse on macs looks different. Installer updated to account for this.
Diffstat (limited to 'src')
-rw-r--r--src/installer/lombok/installer/eclipse/EclipseLocation.java19
-rw-r--r--src/installer/lombok/installer/eclipse/EclipseLocationProvider.java7
2 files changed, 23 insertions, 3 deletions
diff --git a/src/installer/lombok/installer/eclipse/EclipseLocation.java b/src/installer/lombok/installer/eclipse/EclipseLocation.java
index 0fe60c05..6c63c48d 100644
--- a/src/installer/lombok/installer/eclipse/EclipseLocation.java
+++ b/src/installer/lombok/installer/eclipse/EclipseLocation.java
@@ -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 {
diff --git a/src/installer/lombok/installer/eclipse/EclipseLocationProvider.java b/src/installer/lombok/installer/eclipse/EclipseLocationProvider.java
index 914de588..29716a1f 100644
--- a/src/installer/lombok/installer/eclipse/EclipseLocationProvider.java
+++ b/src/installer/lombok/installer/eclipse/EclipseLocationProvider.java
@@ -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 {