From 3ae7052955faa45c91b29e331a7e221cdd15562c Mon Sep 17 00:00:00 2001 From: Pascal Rapicault Date: Fri, 27 Apr 2012 21:10:50 -0400 Subject: Support for bundled macosx - http://bugs.eclipse.org/57349 --- .../internal/frameworkadmin/equinox/EclipseLauncherParser.java | 8 ++++++-- .../equinox/internal/frameworkadmin/equinox/ParserUtils.java | 6 +++++- .../equinox/internal/frameworkadmin/equinox/utils/FileUtils.java | 9 ++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) (limited to 'bundles/org.eclipse.equinox.frameworkadmin.equinox') 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 b714e8e06..8daad28df 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, 2010 IBM Corporation and others. + * Copyright (c) 2007, 2012 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Pascal Rapicault - Support for bundled macosx http://bugs.eclipse.org/57349 *******************************************************************************/ package org.eclipse.equinox.internal.frameworkadmin.equinox; @@ -25,6 +26,7 @@ import org.osgi.service.log.LogService; public class EclipseLauncherParser { private 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 .ini private URI getOSGiInstallArea(List lines, URI base, LauncherData launcherData) { @@ -47,7 +49,9 @@ public class EclipseLauncherParser { 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().getParentFile(); + launcherFolder = launcherFolder.getParentFile().getParentFile(); + if (!launcherData.getOS().endsWith(MACOSX_BUNDLED)) + launcherFolder = launcherFolder.getParentFile(); } 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/ParserUtils.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java index ff4c32b12..9626ad0d5 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 2012 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Pascal Rapicault - Support for bundled macosx http://bugs.eclipse.org/57349 *******************************************************************************/ package org.eclipse.equinox.internal.frameworkadmin.equinox; @@ -57,6 +58,9 @@ public class ParserUtils { 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 e5a439fc3..a74c4941d 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 IBM Corporation and others. + * Copyright (c) 2007, 2012 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Pascal Rapicault - Support for bundled macosx http://bugs.eclipse.org/57349 *******************************************************************************/ package org.eclipse.equinox.internal.frameworkadmin.equinox.utils; @@ -14,12 +15,12 @@ import java.io.*; import java.net.*; import java.util.*; import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxConstants; -import org.eclipse.equinox.internal.frameworkadmin.equinox.ParserUtils; +import org.eclipse.equinox.internal.frameworkadmin.equinox.*; 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$ @@ -79,6 +80,8 @@ public class FileUtils { launcherPath = launcherPath.removeLastSegments(4); 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); -- cgit v1.2.3