diff options
author | Andrew Niefer | 2009-12-11 20:35:51 +0000 |
---|---|---|
committer | Andrew Niefer | 2009-12-11 20:35:51 +0000 |
commit | 31857a7f20ad3d32c7de24cb14912a8d3f870c0a (patch) | |
tree | fdf672db2bbfcc3aea565f0c80d4fe1c18a3f870 | |
parent | 4acefc095e10b5b7f8dc61e4bf705cabd6ff995b (diff) | |
download | rt.equinox.framework-31857a7f20ad3d32c7de24cb14912a8d3f870c0a.tar.gz rt.equinox.framework-31857a7f20ad3d32c7de24cb14912a8d3f870c0a.tar.xz rt.equinox.framework-31857a7f20ad3d32c7de24cb14912a8d3f870c0a.zip |
bug 293831 - aix needs jre/lib/arch on lib search path
-rw-r--r-- | bundles/org.eclipse.equinox.executable/library/eclipse.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipse.c b/bundles/org.eclipse.equinox.executable/library/eclipse.c index 8e1f335fa..633dfefc2 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipse.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipse.c @@ -332,6 +332,7 @@ static _TCHAR* getDefaultOfficialName(); static _TCHAR* findStartupJar(); static _TCHAR* findSplash(_TCHAR* splashArg); static _TCHAR** getRelaunchCommand( _TCHAR **vmCommand ); +static const _TCHAR* getVMArch(); #ifdef _WIN32 static void createConsole(); @@ -1465,8 +1466,9 @@ _TCHAR ** getVMLibrarySearchPath(_TCHAR * vmLibrary) { _TCHAR * buffer = NULL; _TCHAR * path, * entry, *c; _TCHAR separator; - int numPaths = 2; + int numPaths = 3; int i; + struct _stat stats; buffer = (eeLibPath != NULL) ? _tcsdup(eeLibPath) : _tcsdup(vmLibrary); #ifdef WIN32 @@ -1495,7 +1497,7 @@ _TCHAR ** getVMLibrarySearchPath(_TCHAR * vmLibrary) { /* We are either splitting eeLibPath (eg path1:path2), or we are extracting * from libPath where we want the directory containing the library and the - * parent directory of that */ + * parent directory of that, and also grandparent/lib/arch */ for (i = 0; i < numPaths; i++) { c = _tcsrchr(buffer, separator); if (c != 0) { @@ -1515,8 +1517,23 @@ _TCHAR ** getVMLibrarySearchPath(_TCHAR * vmLibrary) { } if (path != NULL) { entry = resolveSymlinks(path); /* this may be a new string */ - paths[i] = malloc((_tcslen(entry) + 2) * sizeof(_TCHAR)); - _stprintf( paths[i], _T_ECLIPSE("%s%c"), entry, pathSeparator ); + if (eeLibPath == NULL && i == 2) { + /* trying grandparent/lib/arch */ + const _TCHAR * arch = getVMArch(); + paths[i] = malloc((_tcslen(entry) + 7 + _tcslen(arch)) * sizeof(_TCHAR)); + _stprintf(paths[i], _T_ECLIPSE("%s/lib/%s"), entry, arch); + /* only add if the path actually exists */ + if (_tstat(paths[i], &stats) == 0) { + _TCHAR separatorString[] = { pathSeparator, 0 }; + _tcscat(paths[i], separatorString); + } else { + free(paths[i]); + paths[i] = NULL; + } + } else { + paths[i] = malloc((_tcslen(entry) + 2) * sizeof(_TCHAR)); + _stprintf( paths[i], _T_ECLIPSE("%s%c"), entry, pathSeparator ); + } if (entry != path) free(entry); path = NULL; @@ -1526,3 +1543,13 @@ _TCHAR ** getVMLibrarySearchPath(_TCHAR * vmLibrary) { free(buffer); return paths; } + +/* translate the osArchArg into the value that we expect the jre to use */ +const _TCHAR* getVMArch() { + if (_tcscmp(osArchArg, _T_ECLIPSE("x86_64")) == 0) + return _T_ECLIPSE("amd64"); + else if (_tcscmp(osArchArg, _T_ECLIPSE("x86")) == 0) + return _T_ECLIPSE("i386"); + else + return osArchArg; +} |