Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c36
-rw-r--r--bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c35
-rw-r--r--bundles/org.eclipse.equinox.executable/library/carbon/make_macosx.mak2
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipse.c3
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipseCommon.c12
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipseCommon.h4
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipseJNI.c4
-rw-r--r--bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c248
8 files changed, 214 insertions, 130 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
index 5be5388df..d4e6de80c 100644
--- a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
+++ b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
@@ -82,8 +82,10 @@ int showSplash( const _TCHAR* featureImage )
if(imageSource != NULL) {
image = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL);
}
+ CFRelease(url);
}
}
+ CFRelease(imageString);
/* If the splash image data could not be loaded, return an error. */
if (image == NULL)
return ENOENT;
@@ -156,12 +158,42 @@ char** getArgVM( char* vm )
}
char * findVMLibrary( char* command ) {
+ char *start, *end;
+ char *version;
+ int length;
+
+ /*check first to see if command already points to the library */
+ start = strrchr( command, dirSeparator ) + 1;
+ if (strcmp(start, "JavaVM") == 0) {
+ return command;
+ }
+
+ /* select a version to use based on the command */
+ start = strstr(command, "/Versions/");
+ if (start != NULL){
+ start += 10;
+ end = strchr( start, dirSeparator);
+ if (end != NULL) {
+ length = end - start;
+ version = malloc(length);
+ strncpy(version, start, length);
+ version[length] = 0;
+
+ setenv("JAVA_JVM_VERSION", version, 1);
+ }
+ }
return "/System/Library/Frameworks/JavaVM.framework/Versions/Current/JavaVM";
}
void restartLauncher( char* program, char* args[] )
{
- /* just restart in-place */
- execv(program, args);
+ pid_t pid= fork();
+ if (pid == 0) {
+ /* Child process ... start the JVM */
+ execv(program, args);
+
+ /* The JVM would not start ... return error code to parent process. */
+ _exit(errno);
+ }
}
diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c
index 85c2db8b3..86d27cac1 100644
--- a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c
+++ b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c
@@ -112,3 +112,38 @@ void unloadLibrary( void * handle ){
void * findSymbol( void * handle, char * symbol ){
return dlsym(handle, symbol);
}
+
+char * resolveSymlinks( char * path ) {
+ CFURLRef url, resolved;
+ CFStringRef string;
+ FSRef fsRef;
+ Boolean isFolder, wasAliased;
+
+ if(path == NULL)
+ return path;
+
+ string = CFStringCreateWithCString(kCFAllocatorDefault, path, kCFStringEncodingASCII);
+ url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, string, kCFURLPOSIXPathStyle, false);
+ CFRelease(string);
+ if(url == NULL)
+ return path;
+
+ if(CFURLGetFSRef(url, &fsRef)) {
+ if( FSResolveAliasFile(&fsRef, true, &isFolder, &wasAliased) == noErr) {
+ resolved = CFURLCreateFromFSRef(kCFAllocatorDefault, &fsRef);
+ if(resolved != NULL) {
+ string = CFURLCopyFileSystemPath(resolved, kCFURLPOSIXPathStyle);
+ CFIndex length = CFStringGetMaximumSizeForEncoding(CFStringGetLength(string), kCFStringEncodingUTF8);
+ char *s = malloc(length);
+ if (CFStringGetCString(string, s, length, kCFStringEncodingUTF8)) {
+ free(path);
+ path = s;
+ }
+ CFRelease(string);
+ CFRelease(resolved);
+ }
+ }
+ }
+ CFRelease(url);
+ return path;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/make_macosx.mak b/bundles/org.eclipse.equinox.executable/library/carbon/make_macosx.mak
index c44a13078..c26555c87 100644
--- a/bundles/org.eclipse.equinox.executable/library/carbon/make_macosx.mak
+++ b/bundles/org.eclipse.equinox.executable/library/carbon/make_macosx.mak
@@ -32,7 +32,7 @@ DLL_OBJS = eclipse.o eclipseCarbon.o eclipseUtil.o eclipseJNI.o
EXEC = $(PROGRAM_OUTPUT)
DLL = $(PROGRAM_LIBRARY)
LIBS = -framework Carbon
-ARCHS = -arch i386 -arch ppc
+ARCHS = #-arch i386 -arch ppc
CFLAGS = -g -s \
-Wall \
$(ARCHS) \
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipse.c b/bundles/org.eclipse.equinox.executable/library/eclipse.c
index e38961804..30dfe9da0 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipse.c
+++ b/bundles/org.eclipse.equinox.executable/library/eclipse.c
@@ -866,7 +866,8 @@ static _TCHAR ** getRelaunchCommand( _TCHAR **vmCommand )
}
}
- relaunch = malloc((i + 1) * sizeof(_TCHAR *));
+ relaunch = malloc((1 + i + 1) * sizeof(_TCHAR *));
+ relaunch[idx++] = program;
for (i = begin; vmCommand[i] != NULL; i++){
if (_tcsicmp(vmCommand[i], SHOWSPLASH) == 0) {
/* remove if the next argument is not the bitmap to show */
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.c b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.c
index bb8e6e11a..0011ffae0 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.c
+++ b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.c
@@ -186,16 +186,20 @@ _TCHAR* findCommand( _TCHAR* command )
cmdPath = NULL;
}
+ return resolveSymlinks(cmdPath);
+}
+
#if !defined(_WIN32) && !defined(MACOSX)
+char * resolveSymlinks( char * path ) {
+ if(path == NULL)
+ return path;
/* resolve symlinks */
- ch = cmdPath;
+ char * ch = cmdPath;
cmdPath = canonicalize_file_name(cmdPath);
free(ch);
-#endif
-
- /* Return the absolute command pathname. */
return cmdPath;
}
+#endif
#ifndef _WIN32
#ifdef MACOSX
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h
index cd7a4a4c6..fcfe90530 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h
+++ b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h
@@ -37,6 +37,7 @@
#define osArg osArgW
#define wsArg wsArgW
#define osArchArg osArchArgW
+#define resolveSymlinks resolveSymlinksW
#endif
#ifdef UNICODE
@@ -71,6 +72,9 @@ extern _TCHAR* findFile( _TCHAR* path, _TCHAR* prefix);
extern _TCHAR* getProgramDir();
+
+extern _TCHAR* resolveSymlinks( _TCHAR* path );
+
/** Display a Message
*
* This method is called to display an error message to the user before exiting.
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c
index 283b4c21c..fd34a7605 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c
+++ b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c
@@ -209,7 +209,11 @@ int startJavaVM( _TCHAR* libPath, _TCHAR* vmArgs[], _TCHAR* progArgs[] )
options[i].extraInfo = 0;
}
+#ifdef MACOSX
+ init_args.version = JNI_VERSION_1_4;
+#else
init_args.version = JNI_VERSION_1_2;
+#endif
init_args.options = options;
init_args.nOptions = numVMArgs;
init_args.ignoreUnrecognized = JNI_TRUE;
diff --git a/bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c b/bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c
index bbc4ae5f9..e7d9b5758 100644
--- a/bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c
+++ b/bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c
@@ -1,122 +1,126 @@
-/*******************************************************************************
- * Copyright (c) 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Andrew Niefer
- *******************************************************************************/
-
-#include "eclipseCommon.h"
-#include "eclipseOS.h"
-
-#include <windows.h>
-#include <stdlib.h>
-#include <commctrl.h>
-
-#define ECLIPSE_ICON 401
-
-_TCHAR dirSeparator = _T('\\');
-_TCHAR pathSeparator = _T(';');
-
-void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash );
-/*static LRESULT WINAPI WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);*/
-
-/* Global Main Window*/
-#ifdef UNICODE
-extern HWND topWindow;
-#else
-HWND topWindow = 0;
-#endif
-
-/* Define local variables for the main window. */
-/*static WNDPROC oldProc;*/
-
-static int initialized = 0;
-
-/* Display a Message */
-void displayMessage( _TCHAR* title, _TCHAR* message )
-{
- if(!initialized)
- initWindowSystem(0, NULL, 0);
- MessageBox( topWindow, message, title, MB_OK );
-}
-
-/* Initialize Window System
- *
- * Create a pop window to display the bitmap image.
- *
- * Return the window handle as the data for the splash command.
- *
- */
-void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash )
-{
- if(initialized)
- return;
- /* Create a window that has no decorations. */
-
- InitCommonControls();
- topWindow = CreateWindowEx (0,
- _T("STATIC"),
- officialName,
- SS_BITMAP | WS_POPUP,
- CW_USEDEFAULT,
- 0,
- CW_USEDEFAULT,
- 0,
- NULL,
- NULL,
- GetModuleHandle (NULL),
- NULL);
- SetClassLong(topWindow, GCL_HICON, (LONG)LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(ECLIPSE_ICON)));
-/*
- oldProc = (WNDPROC) GetWindowLong (topWindow, GWL_WNDPROC);
- SetWindowLong (topWindow, GWL_WNDPROC, (LONG) WndProc);
-*/
- initialized = 1;
-}
-
-/* Window Procedure for the Spash window.
- *
- * A special WndProc is needed to return the proper vlaue for WM_NCHITTEST.
- * It must also detect the message from the splash window process.
- */
-/*static LRESULT WINAPI WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- switch (uMsg)
- {
- case WM_NCHITTEST: return HTCLIENT;
- case WM_CLOSE:
- PostQuitMessage( 0 );
- break;
- }
- return CallWindowProc (oldProc, hwnd, uMsg, wParam, lParam);
-}*/
-
-/* Load the specified shared library
- */
-void * loadLibrary( _TCHAR * library ){
- return LoadLibrary(library);
-}
-
-/* Unload the shared library
- */
-void unloadLibrary( void * handle ){
- FreeLibrary(handle);
-}
-
-/* Find the given symbol in the shared library
- */
-void * findSymbol( void * handle, _TCHAR * symbol ){
- char * str = NULL;
- void * result;
-
- str = toNarrow(symbol);
- result = GetProcAddress(handle, str);
- free(str);
- return result;
-}
-
+/*******************************************************************************
+ * Copyright (c) 2006 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Andrew Niefer
+ *******************************************************************************/
+
+#include "eclipseCommon.h"
+#include "eclipseOS.h"
+
+#include <windows.h>
+#include <stdlib.h>
+#include <commctrl.h>
+
+#define ECLIPSE_ICON 401
+
+_TCHAR dirSeparator = _T('\\');
+_TCHAR pathSeparator = _T(';');
+
+void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash );
+/*static LRESULT WINAPI WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);*/
+
+/* Global Main Window*/
+#ifdef UNICODE
+extern HWND topWindow;
+#else
+HWND topWindow = 0;
+#endif
+
+/* Define local variables for the main window. */
+/*static WNDPROC oldProc;*/
+
+static int initialized = 0;
+
+/* Display a Message */
+void displayMessage( _TCHAR* title, _TCHAR* message )
+{
+ if(!initialized)
+ initWindowSystem(0, NULL, 0);
+ MessageBox( topWindow, message, title, MB_OK );
+}
+
+/* Initialize Window System
+ *
+ * Create a pop window to display the bitmap image.
+ *
+ * Return the window handle as the data for the splash command.
+ *
+ */
+void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash )
+{
+ if(initialized)
+ return;
+ /* Create a window that has no decorations. */
+
+ InitCommonControls();
+ topWindow = CreateWindowEx (0,
+ _T("STATIC"),
+ officialName,
+ SS_BITMAP | WS_POPUP,
+ CW_USEDEFAULT,
+ 0,
+ CW_USEDEFAULT,
+ 0,
+ NULL,
+ NULL,
+ GetModuleHandle (NULL),
+ NULL);
+ SetClassLong(topWindow, GCL_HICON, (LONG)LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(ECLIPSE_ICON)));
+/*
+ oldProc = (WNDPROC) GetWindowLong (topWindow, GWL_WNDPROC);
+ SetWindowLong (topWindow, GWL_WNDPROC, (LONG) WndProc);
+*/
+ initialized = 1;
+}
+
+/* Window Procedure for the Spash window.
+ *
+ * A special WndProc is needed to return the proper vlaue for WM_NCHITTEST.
+ * It must also detect the message from the splash window process.
+ */
+/*static LRESULT WINAPI WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch (uMsg)
+ {
+ case WM_NCHITTEST: return HTCLIENT;
+ case WM_CLOSE:
+ PostQuitMessage( 0 );
+ break;
+ }
+ return CallWindowProc (oldProc, hwnd, uMsg, wParam, lParam);
+}*/
+
+/* Load the specified shared library
+ */
+void * loadLibrary( _TCHAR * library ){
+ return LoadLibrary(library);
+}
+
+/* Unload the shared library
+ */
+void unloadLibrary( void * handle ){
+ FreeLibrary(handle);
+}
+
+/* Find the given symbol in the shared library
+ */
+void * findSymbol( void * handle, _TCHAR * symbol ){
+ char * str = NULL;
+ void * result;
+
+ str = toNarrow(symbol);
+ result = GetProcAddress(handle, str);
+ free(str);
+ return result;
+}
+
+_TCHAR* resolveSymlinks( _TCHAR* path ) {
+ /* no symlinks on windows */
+ return path;
+}

Back to the top