diff options
author | Andrew Niefer | 2007-10-05 18:31:28 +0000 |
---|---|---|
committer | Andrew Niefer | 2007-10-05 18:31:28 +0000 |
commit | 924619f48567bc2fae2e73a85e693a6432b01546 (patch) | |
tree | 147dec641834624c63c4befb540bd4f520fa3196 | |
parent | 2cb8cc250a06e04d4e237eb33b60a2a07ec8d9e6 (diff) | |
download | rt.equinox.framework-924619f48567bc2fae2e73a85e693a6432b01546.tar.gz rt.equinox.framework-924619f48567bc2fae2e73a85e693a6432b01546.tar.xz rt.equinox.framework-924619f48567bc2fae2e73a85e693a6432b01546.zip |
bug 176021
3 files changed, 30 insertions, 12 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipse.c b/bundles/org.eclipse.equinox.executable/library/eclipse.c index c5b9ecc48..8d426f459 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipse.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipse.c @@ -1197,7 +1197,7 @@ static int determineVM(_TCHAR** msg) { /* No default.ee file, look for default VM */ ch = malloc((_tcslen(vmName) + 1 + _tcslen(defaultVM) + 1) * sizeof(_TCHAR)); _stprintf( ch, _T_ECLIPSE("%s%c%s"), vmName, dirSeparator, defaultVM ); - javaVM = findCommand(ch); + javaVM = findSymlinkCommand(ch, 0); free(ch); if (javaVM == NULL) { /* No vm executable, look for library */ @@ -1234,13 +1234,13 @@ static int determineVM(_TCHAR** msg) { } if (eeConsole != NULL && (debug || needConsole) ) { - javaVM = findCommand(eeConsole); + javaVM = findSymlinkCommand(eeConsole, 0); if (javaVM != NULL) return LAUNCH_EXE; } if (eeExecutable != NULL) { - javaVM = findCommand(eeExecutable); + javaVM = findSymlinkCommand(eeExecutable, 0); if (javaVM != NULL) return LAUNCH_EXE; } @@ -1268,7 +1268,7 @@ static int determineVM(_TCHAR** msg) { default: /*otherwise, assume executable */ - javaVM = findCommand(vmName); + javaVM = findSymlinkCommand(vmName, 0); if(javaVM != NULL) { #ifdef MACOSX /* right now, we are always doing JNI on Mac */ @@ -1295,13 +1295,13 @@ static int determineVM(_TCHAR** msg) { _stprintf( ch, _T_ECLIPSE("%s%s%s"), programDir, shippedVMDir, defaultVM ); vmSearchPath = _tcsdup(ch); - javaVM = findCommand( ch ); + javaVM = findSymlinkCommand( ch, 0 ); free(ch); } if (javaVM == NULL) { - /* vm found yet, look for one on the search path */ - javaVM = findCommand(defaultVM); + /* vm not found yet, look for one on the search path, but don't resolve symlinks */ + javaVM = findSymlinkCommand(defaultVM, 0); if (javaVM == NULL) { /* can't find vm, error */ ch = malloc( (_tcslen(pathMsg) + _tcslen(defaultVM) + 1) * sizeof(_TCHAR)); @@ -1322,7 +1322,11 @@ static int determineVM(_TCHAR** msg) { free(vmSearchPath); #ifndef DEFAULT_JAVA_EXEC - jniLib = findVMLibrary(javaVM); + /* resolve symlinks for finding the library */ + ch = resolveSymlinks(javaVM); + jniLib = findVMLibrary(ch); + if (ch != jniLib && ch != javaVM) + free(ch); if (jniLib != NULL) return LAUNCH_JNI; #endif diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.c b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.c index 487937413..2d6872821 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.c @@ -178,6 +178,11 @@ int setenv (const char *name, const char *value, int replace) #define EXTRA 20 _TCHAR* findCommand( _TCHAR* command ) { + return findSymlinkCommand( command, 1 ); +} + +_TCHAR* findSymlinkCommand( _TCHAR* command, int resolve ) +{ _TCHAR* cmdPath; size_t length; _TCHAR* ch; @@ -302,10 +307,12 @@ _TCHAR* findCommand( _TCHAR* command ) return cmdPath; } - ch = resolveSymlinks(cmdPath); - if (ch != cmdPath) { - free(cmdPath); - cmdPath = ch; + if (resolve) { + ch = resolveSymlinks(cmdPath); + if (ch != cmdPath) { + free(cmdPath); + cmdPath = ch; + } } return cmdPath; } diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h index f9fff1751..608e06a2c 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h +++ b/bundles/org.eclipse.equinox.executable/library/eclipseCommon.h @@ -27,6 +27,7 @@ #define displayMessage displayMessageW #define getProgramDir getProgramDirW #define findCommand findCommandW +#define findSymlinkCommand findSymlinkCommandW #define findFile findFileW #define loadLibrary loadLibraryW #define unloadLibrary unloadLibraryW @@ -74,9 +75,15 @@ extern char *toNarrow(_TCHAR* src); * Find the absolute pathname to where a command resides. * * The string returned by the function must be freed. + * Symlinks are resolved */ extern _TCHAR* findCommand( _TCHAR* command ); +/* + * Same as findCommand but optionally resolve symlinks + */ +extern _TCHAR* findSymlinkCommand( _TCHAR* command, int resolve ); + extern _TCHAR* findFile( _TCHAR* path, _TCHAR* prefix); extern _TCHAR* getProgramDir(); |