Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2007-07-24 15:05:37 -0400
committerAndrew Niefer2007-07-24 15:05:37 -0400
commite2e3c706503b04f55a8bdc8bb8caef895ae1fb70 (patch)
tree7536ea40208c54bb973411e84d67be8583bf0cb1 /bundles/org.eclipse.equinox.executable/library/wpf
parentaafa6e6ba60701d8ef47d83f8814ebb4119d1329 (diff)
downloadrt.equinox.framework-e2e3c706503b04f55a8bdc8bb8caef895ae1fb70.tar.gz
rt.equinox.framework-e2e3c706503b04f55a8bdc8bb8caef895ae1fb70.tar.xz
rt.equinox.framework-e2e3c706503b04f55a8bdc8bb8caef895ae1fb70.zip
bug 195384
Diffstat (limited to 'bundles/org.eclipse.equinox.executable/library/wpf')
-rw-r--r--bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpf.cpp47
1 files changed, 14 insertions, 33 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpf.cpp b/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpf.cpp
index 390cb14a3..7edbecace 100644
--- a/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpf.cpp
+++ b/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpf.cpp
@@ -243,54 +243,33 @@ void adjustSearchPath( _TCHAR* vmLib ){
int needAdjust = 0, freePath = 0;
/* we want the directory containing the library, and the parent directory of that */
- paths = (_TCHAR**) malloc( 2 * sizeof(_TCHAR*));
- buffer = _tcsdup(vmLib);
- for (i = 0; i < 2; i++ ){
- c = _tcsrchr(buffer, dirSeparator);
- *c = 0;
- length = _tcslen(buffer);
- paths[i] = (_TCHAR*) malloc((length + 2) * sizeof(_TCHAR));
- _stprintf( paths[i], _T_ECLIPSE("%s%c"), buffer, pathSeparator );
- }
- free(buffer);
+ paths = getVMLibrarySearchPath(vmLib);
/* first call to GetEnvironmentVariable tells us how big to make the buffer */
length = GetEnvironmentVariable(_T_ECLIPSE("PATH"), path, 0);
if (length > 0) {
path = (_TCHAR*)malloc(length * sizeof(_TCHAR));
GetEnvironmentVariable(_T_ECLIPSE("PATH"), path, length);
+ needAdjust = containsPaths(path, paths);
freePath = 1;
} else {
path = _T_ECLIPSE("");
freePath = 0;
needAdjust = 1;
}
-
- if(length > 0) {
- buffer = (_TCHAR*)malloc((_tcslen(path) + 2) * sizeof(_TCHAR));
- _stprintf(buffer, _T_ECLIPSE("%s%c"), path, pathSeparator);
- /* check if each of our paths is already on the search path */
- for (i = 0; i < 2; i++) {
- c = _tcsstr(buffer, paths[i]);
- if ( c == NULL || !(c == buffer || *(c - 1) == pathSeparator))
- {
- /* entry not found */
- needAdjust = 1;
- break;
- }
- }
- free(buffer);
- }
-
- newPath = (_TCHAR*)malloc((length + 1 + _tcslen(paths[0]) + 1 + _tcslen(paths[1]) + 1) * sizeof(_TCHAR));
- _stprintf(newPath, _T_ECLIPSE("%s%s%s"), paths[0], paths[1], path);
- SetEnvironmentVariable( _T_ECLIPSE("PATH"), newPath);
+ if (needAdjust) {
+ c = concatStrings(paths);
+ newPath = malloc((_tcslen(c) + length + 1) * sizeof(_TCHAR));
+ _stprintf(newPath, _T_ECLIPSE("%s%s"), c, path);
+ SetEnvironmentVariable( _T_ECLIPSE("PATH"), newPath);
+ free(c);
+ free(newPath);
+ }
- for (i = 0; i < 2; i++)
+ for (i = 0; i < 2 && paths[i] != NULL; i++)
free(paths[i]);
free(paths);
- free(newPath);
if (freePath)
free(path);
}
@@ -313,7 +292,9 @@ static _TCHAR* findLib( _TCHAR* command ) {
/*check first to see if command already points to the library */
if (isVMLibrary(command)) {
- return command;
+ if (_tstat( command, &stats ) == 0 && (stats.st_mode & S_IFREG) != 0)
+ return command; /* exists */
+ return NULL; /* doesn't exist */
}
pathLength = location - command;

Back to the top