diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-07-26 08:55:14 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-07-26 08:55:14 +0200 |
commit | 0d9bde828d548893108f78a281016150121b1d8d (patch) | |
tree | 998d146cdb90e911b635af38f6fcd87c1244437e | |
parent | ae83845e86715e7b2fd44698a5e84ca749fdcb09 (diff) | |
download | lombok-0d9bde828d548893108f78a281016150121b1d8d.tar.gz lombok-0d9bde828d548893108f78a281016150121b1d8d.tar.bz2 lombok-0d9bde828d548893108f78a281016150121b1d8d.zip |
Addresses issue #6:
For whatever reason, the path to the javaagent in eclipse.ini on linux needs to be absolute.
-rw-r--r-- | src/lombok/installer/EclipseLocation.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lombok/installer/EclipseLocation.java b/src/lombok/installer/EclipseLocation.java index fa49c7c3..d6a2f4b7 100644 --- a/src/lombok/installer/EclipseLocation.java +++ b/src/lombok/installer/EclipseLocation.java @@ -279,6 +279,12 @@ final class EclipseLocation { void install() throws InstallException { List<File> failedDirs = new ArrayList<File>(); + // For whatever reason, relative paths in your eclipse.ini file don't work on linux, but only for -javaagent. + // If someone knows how to fix this, please do so, as this current hack solution (putting the absolute path + // to the jar files in your eclipse.ini) means you can't move your eclipse around on linux without lombok + // breaking it. NB: rerunning lombok.jar installer and hitting 'update' will fix it if you do that. + boolean fullPathRequired = EclipseFinder.getOS() == EclipseFinder.OS.UNIX; + boolean installSucceeded = false; for ( File dir : getTargetDirs() ) { File iniFile = new File(dir, "eclipse.ini"); @@ -367,8 +373,14 @@ final class EclipseLocation { fis.close(); } - newContents.append("-javaagent:lombok.eclipse.agent.jar").append(OS_NEWLINE); - newContents.append("-Xbootclasspath/a:lombok.jar" + File.pathSeparator + "lombok.eclipse.agent.jar").append(OS_NEWLINE); + String fullPathToLombok = fullPathRequired ? (lombokJar.getParentFile().getCanonicalPath() + File.separator) : ""; + String fullPathToAgent = fullPathRequired ? (agentJar.getParentFile().getCanonicalPath() + File.separator) : ""; + + newContents.append(String.format( + "-javaagent:%slombok.eclipse.agent.jar", fullPathToLombok)).append(OS_NEWLINE); + newContents.append(String.format( + "-Xbootclasspath/a:%slombok.jar" + File.pathSeparator + "%slombok.eclipse.agent.jar", + fullPathToLombok, fullPathToAgent)).append(OS_NEWLINE); FileOutputStream fos = new FileOutputStream(iniFile); try { |