Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Georgi2014-06-25 04:15:30 -0400
committerTobias Oberlies2015-01-12 04:26:29 -0500
commit17907d0431365abe39ac5242252723cf3b307a7d (patch)
tree75f232af3785eb6cff8384cb24db79f9ad2e02e7 /bundles/org.eclipse.equinox.frameworkadmin.equinox
parent3e1ee0a24a2946e1acc975c39a687c559262c4de (diff)
downloadrt.equinox.p2-17907d0431365abe39ac5242252723cf3b307a7d.tar.gz
rt.equinox.p2-17907d0431365abe39ac5242252723cf3b307a7d.tar.xz
rt.equinox.p2-17907d0431365abe39ac5242252723cf3b307a7d.zip
Bug 437680 - Correctly relativize VM pathI20150116-1000I20150113-0800
Especially on Mac OS the launcher path and the VM path have only some path segments in common, and URI.relativize(URI) fails in this case. Bug: 437680 Change-Id: I4b854bcba8d7738dc1cca96f5d492474f41ab6d8 Signed-off-by: Christian Georgi <christian.georgi@sap.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.frameworkadmin.equinox')
-rw-r--r--bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java
index 87c22c4f3..1154b6bbb 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Pascal Rapicault - Support for bundled macosx http://bugs.eclipse.org/57349
+ * Christian Georgi - Relativize VM path https://bugs.eclipse.org/bugs/437680
*******************************************************************************/
package org.eclipse.equinox.internal.frameworkadmin.equinox;
@@ -24,7 +25,7 @@ import org.eclipse.osgi.util.NLS;
import org.osgi.service.log.LogService;
public class EclipseLauncherParser {
- private static final String MAC_OS_APP_FOLDER = ".app/Contents/MacOS"; //$NON-NLS-1$
+ public static final String MAC_OS_APP_FOLDER = ".app/Contents/MacOS"; //$NON-NLS-1$
private static final String CONFIGURATION_FOLDER = "configuration"; //$NON-NLS-1$
public static final String MACOSX_BUNDLED = "macosx-bundled"; //$NON-NLS-1$
@@ -115,7 +116,7 @@ public class EclipseLauncherParser {
}
}
- private void setVM(List<String> lines, File vm, URI launcherFolder) {
+ private void setVM(List<String> lines, File vm, URI launcherFolder, File installHome) {
if (vm == null) {
if (ParserUtils.getValueForArgument(EquinoxConstants.OPTION_VM, lines) != null)
return;
@@ -126,7 +127,20 @@ public class EclipseLauncherParser {
URI vmRelativePath = null;
if (vm.isAbsolute()) {
- vmRelativePath = launcherFolder.relativize(vm.toURI());
+ // Bug 437680: Correctly relativize on MacOS
+ // Example: (traditional layout) (bundled layout)
+ // Install home: install/ Eclipse.app/
+ // Launcher: Eclipse.app/Contents/MacOS/ Contents/MacOS/
+ // VM: jre/ jre/
+ // Result: ../../../jre ../../jre
+ URI vmRelativePathToHome = installHome.toURI().relativize(vm.toURI());
+ if (vmRelativePathToHome.isAbsolute()) {
+ // VM is not below the install root -> use absolute path
+ vmRelativePath = vmRelativePathToHome;
+ } else {
+ // make VM path relative to launcher folder (which is different to the install root in MacOS installs)
+ vmRelativePath = URIUtil.makeRelative(vm.toURI(), launcherFolder);
+ }
} else {
//For relative files, File#toURI will create an absolute URI by resolving against the current working directory, we don't want that
String path = vm.getPath().replace('\\', '/');
@@ -296,7 +310,7 @@ public class EclipseLauncherParser {
setConfigurationLocation(newlines, osgiInstallArea.toURI(), launcherData);
setLauncherLibrary(newlines, launcherFolder.toURI());
// setFrameworkJar(newlines, launcherData.getFwJar());
- setVM(newlines, launcherData.getJvm(), launcherFolder.toURI());
+ setVM(newlines, launcherData.getJvm(), launcherFolder.toURI(), launcherData.getHome());
//We are done, let's update the program args in the launcher data
launcherData.setProgramArgs(null);

Back to the top