Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2015-02-16 22:19:15 +0000
committerPascal Rapicault2015-02-16 22:19:15 +0000
commit2c73306fc02a649f2bea26ecb5f351ca3e14999a (patch)
tree63e3ec9deab989ee4fc85078a200d6da64f338ce /bundles/org.eclipse.equinox.p2.touchpoint.eclipse
parent0fdb03cf79ad3493245ba7f37b6fda5775dbd836 (diff)
downloadrt.equinox.p2-2c73306fc02a649f2bea26ecb5f351ca3e14999a.tar.gz
rt.equinox.p2-2c73306fc02a649f2bea26ecb5f351ca3e14999a.tar.xz
rt.equinox.p2-2c73306fc02a649f2bea26ecb5f351ca3e14999a.zip
Revert "WIP mac"I20150217-0800
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.touchpoint.eclipse')
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/LazyManipulator.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java55
2 files changed, 44 insertions, 13 deletions
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/LazyManipulator.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/LazyManipulator.java
index 6a6bad74d..4e8857043 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/LazyManipulator.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/LazyManipulator.java
@@ -48,7 +48,7 @@ public class LazyManipulator implements Manipulator {
launcherData.setFwConfigLocation(Util.getConfigurationFolder(profile));
launcherData.setLauncher(Util.getLauncherPath(profile));
launcherData.setLauncherConfigLocation(Util.getLauncherConfigLocation(profile));
- launcherData.setOS(Util.getOSFromProfile(profile));
+ launcherData.setOS(Util.isMacOSBundled(profile) ? org.eclipse.equinox.p2.core.spi.Constants.MACOSX_BUNDLED : Util.getOSFromProfile(profile));
launcherData.setHome(Util.getInstallFolder(profile));
try {
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
index a5a6d8971..dc85fe237 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
@@ -15,6 +15,7 @@
package org.eclipse.equinox.internal.p2.touchpoint.eclipse;
import java.io.File;
+import java.io.IOException;
import java.net.*;
import java.util.*;
import org.eclipse.core.runtime.*;
@@ -22,6 +23,7 @@ import org.eclipse.equinox.frameworkadmin.BundleInfo;
import org.eclipse.equinox.internal.p2.core.helpers.*;
import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
import org.eclipse.equinox.p2.core.*;
+import org.eclipse.equinox.p2.core.spi.Constants;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.metadata.*;
import org.eclipse.equinox.p2.repository.IRepository;
@@ -269,23 +271,23 @@ public class Util {
String name = profile.getProperty(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME);
if (name == null || name.length() == 0)
name = "eclipse"; //$NON-NLS-1$
- String relativePath = getLauncherRelativePath(name, getOSFromProfile(profile), getInstallFolder(profile));
- return relativePath == null ? null : new File(getInstallFolder(profile), relativePath);
+ String launcherName = getLauncherName(name, (isMacOSBundled(profile) ? Constants.MACOSX_BUNDLED : getOSFromProfile(profile)), getInstallFolder(profile));
+ return launcherName == null ? null : new File(getInstallFolder(profile), launcherName);
}
- // public static boolean isMacOSBundled(IProfile profile) {
- // String environments = profile.getProperty(IProfile.PROP_ENVIRONMENTS);
- // if (environments == null)
- // return false;
- // if (environments.indexOf(Constants.MACOSX_BUNDLED + "=true") != -1) //$NON-NLS-1$
- // return true;
- // return false;
- // }
+ public static boolean isMacOSBundled(IProfile profile) {
+ String environments = profile.getProperty(IProfile.PROP_ENVIRONMENTS);
+ if (environments == null)
+ return false;
+ if (environments.indexOf(Constants.MACOSX_BUNDLED + "=true") != -1) //$NON-NLS-1$
+ return true;
+ return false;
+ }
/**
* Returns the name of the Eclipse application launcher.
*/
- private static String getLauncherRelativePath(String name, String os, File installFolder) {
+ private static String getLauncherName(String name, String os, File installFolder) {
if (os == null) {
EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName());
if (info == null)
@@ -299,9 +301,38 @@ public class Util {
return name;
return name + ".exe"; //$NON-NLS-1$
}
+ if (os.equals(Constants.MACOSX_BUNDLED)) {
+ return "/Contents/MacOS/" + name; //$NON-NLS-1$
+ }
if (os.equals(org.eclipse.osgi.service.environment.Constants.OS_MACOSX)) {
- return "../MacOS/" + name;
+ IPath path = new Path(name);
+ if (path.segment(0).endsWith(".app")) //$NON-NLS-1$
+ return name;
+
+ String appName = null;
+ if (installFolder != null) {
+ File appFolder = new File(installFolder, name + ".app"); //$NON-NLS-1$
+ if (appFolder.exists()) {
+ try {
+ appName = appFolder.getCanonicalFile().getName();
+ } catch (IOException e) {
+ appName = appFolder.getName();
+ }
+ }
+ }
+
+ StringBuffer buffer = new StringBuffer();
+ if (appName != null) {
+ buffer.append(appName);
+ } else {
+ buffer.append(name.substring(0, 1).toUpperCase());
+ buffer.append(name.substring(1));
+ buffer.append(".app"); //$NON-NLS-1$
+ }
+ buffer.append("/Contents/MacOS/"); //$NON-NLS-1$
+ buffer.append(name);
+ return buffer.toString();
}
return name;
}

Back to the top