diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal')
4 files changed, 19 insertions, 25 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 1154b6bbb..e87a69954 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 @@ -21,13 +21,12 @@ import org.eclipse.equinox.internal.frameworkadmin.equinox.utils.FileUtils; import org.eclipse.equinox.internal.frameworkadmin.utils.Utils; import org.eclipse.equinox.internal.provisional.frameworkadmin.FrameworkAdminRuntimeException; import org.eclipse.equinox.internal.provisional.frameworkadmin.LauncherData; +import org.eclipse.osgi.service.environment.Constants; import org.eclipse.osgi.util.NLS; import org.osgi.service.log.LogService; public class EclipseLauncherParser { - 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$ //this figures out the location of the data area on partial data read from the <eclipse>.ini private URI getOSGiInstallArea(List<String> lines, URI base, LauncherData launcherData) { @@ -47,14 +46,11 @@ public class EclipseLauncherParser { ParserUtils.removeArgument(EquinoxConstants.OPTION_INSTALL, lines); return; } - String launcherString = launcherFolder.getAbsolutePath().replace('\\', '/'); - if (launcherString.endsWith(MAC_OS_APP_FOLDER)) { - //We can do 3 calls to getParentFile without checking because - launcherFolder = launcherFolder.getParentFile().getParentFile(); - if (!launcherData.getOS().endsWith(MACOSX_BUNDLED)) - launcherFolder = launcherFolder.getParentFile(); - } - if (!ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()).equals(launcherFolder)) { + if (Constants.OS_MACOSX.equals(launcherData.getOS())) { + if (!new File(ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()), "../MacOS").equals(launcherFolder)) { + ParserUtils.setValueForArgument(EquinoxConstants.OPTION_INSTALL, launcherFolder.getAbsolutePath().replace('\\', '/'), lines); + } + } else if (!ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()).equals(launcherFolder)) { ParserUtils.setValueForArgument(EquinoxConstants.OPTION_INSTALL, launcherFolder.getAbsolutePath().replace('\\', '/'), lines); } } diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java index f516d4da7..c8e646fbf 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java @@ -93,7 +93,10 @@ public class EquinoxManipulatorImpl implements Manipulator { int dotLocation = launcherName.lastIndexOf('.'); if (dotLocation != -1) launcherName = launcherName.substring(0, dotLocation); - File result = new File(launcher.getParentFile(), launcherName + EquinoxConstants.INI_EXTENSION); + File launcherFolder = launcher.getParentFile(); + if (org.eclipse.osgi.service.environment.Constants.OS_MACOSX.equals(launcherData.getOS())) + launcherFolder = launcherData.getFwConfigLocation().getParentFile(); + File result = new File(launcherFolder, launcherName + EquinoxConstants.INI_EXTENSION); return result; } diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java index 4080ffcb6..12ba81aac 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java @@ -48,19 +48,16 @@ public class ParserUtils { File launcherFile = launcherData.getLauncher(); if (launcherFile != null) { - if (Constants.OS_MACOSX.equals(launcherData.getOS())) { - //the equinox launcher will look 3 levels up on the mac when going from executable to launcher.jar + if (Constants.OS_MACOSX.equals(launcherData.getOS())) { // + //TODO We are going to change this - the equinox launcher will look 3 levels up on the mac when going from executable to launcher.jar //see org.eclipse.equinox.executable/library/eclipse.c : findStartupJar(); IPath launcherPath = new Path(launcherFile.getAbsolutePath()); - if (launcherPath.segmentCount() > 4) { - //removing "Eclipse.app/Contents/MacOS/eclipse" - launcherPath = launcherPath.removeLastSegments(4); + if (launcherPath.segmentCount() > 2) { + //removing "MacOS/eclipse" from the end of the path + launcherPath = launcherPath.removeLastSegments(2).append("Eclipse"); //$NON-NLS-1$ return launcherPath.toFile(); } } - if (EclipseLauncherParser.MACOSX_BUNDLED.equals(launcherData.getOS())) { - Log.log(LogService.LOG_WARNING, "Problem figuring out the osgi install area. The bundled mode of macosx requires a -startup argument to be specified."); //$NON-NLS-1$ - } return launcherFile.getParentFile(); } return null; diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java index 7eed2d207..24dd3b719 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/utils/FileUtils.java @@ -15,12 +15,12 @@ import java.io.*; import java.net.*; import java.util.*; import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.frameworkadmin.equinox.*; +import org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxConstants; +import org.eclipse.equinox.internal.frameworkadmin.equinox.ParserUtils; import org.eclipse.equinox.internal.provisional.frameworkadmin.LauncherData; import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator; import org.eclipse.osgi.service.environment.Constants; import org.osgi.framework.Version; -import org.osgi.service.log.LogService; public class FileUtils { private static String FILE_SCHEME = "file"; //$NON-NLS-1$ @@ -76,12 +76,10 @@ public class FileUtils { File launcherDir = null; if (Constants.OS_MACOSX.equals(launcherData.getOS())) { IPath launcherPath = new Path(launcherData.getLauncher().getAbsolutePath()); - if (launcherPath.segmentCount() > 4) { - launcherPath = launcherPath.removeLastSegments(4); + if (launcherPath.segmentCount() > 2) { + launcherPath = launcherPath.removeLastSegments(2).append("Eclipse"); launcherDir = launcherPath.toFile(); } - } else if (EclipseLauncherParser.MACOSX_BUNDLED.equals(launcherData.getOS())) { - Log.log(LogService.LOG_WARNING, "Problem figuring out the osgi install area. The bundled mode of macosx requires a -startup argument to be specified."); //$NON-NLS-1$ } else launcherDir = launcherData.getLauncher().getParentFile(); pluginsDir = new File(launcherDir, EquinoxConstants.PLUGINS_DIR); |