Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2009-11-12 19:42:23 +0000
committerAndrew Niefer2009-11-12 19:42:23 +0000
commitc70c29c1cda284f217ebadc90224027227c23d67 (patch)
tree37df6211657a518dccd6328025fa51832592bbd0 /bundles/org.eclipse.equinox.executable
parent0844583ccd5d4427e01dcca15df7eacbe1a4b2bd (diff)
downloadrt.equinox.framework-c70c29c1cda284f217ebadc90224027227c23d67.tar.gz
rt.equinox.framework-c70c29c1cda284f217ebadc90224027227c23d67.tar.xz
rt.equinox.framework-c70c29c1cda284f217ebadc90224027227c23d67.zip
bug 293831 - need jre/lib/arch on library search path
Diffstat (limited to 'bundles/org.eclipse.equinox.executable')
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipse.c35
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 a44ba98ac..204b1009f 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipse.c
+++ b/bundles/org.eclipse.equinox.executable/library/eclipse.c
@@ -330,6 +330,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();
@@ -1516,8 +1517,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
@@ -1546,7 +1548,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) {
@@ -1566,8 +1568,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;
@@ -1577,3 +1594,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;
+}

Back to the top