summaryrefslogtreecommitdiff
path: root/desktop/win32
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-06-16 13:19:59 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-06-16 13:19:59 +0000
commit797aba8a2726c0132a0f185756d8ec22341ff500 (patch)
tree2d65eea0365df07a7ae6475ab48fc2059e881efc /desktop/win32
parent52445264b77607a591a66a73b798b143b89bade6 (diff)
INTEGRATION: CWS sb88 (1.6.2); FILE MERGED
2008/06/11 12:12:38 sb 1.6.2.1: #i88680# make guiloader work in Basis layer as well as Brand layer (so that it can be used as testtool.exe in Basis layer)
Diffstat (limited to 'desktop/win32')
-rw-r--r--desktop/win32/source/extendloaderenvironment.cxx44
1 files changed, 27 insertions, 17 deletions
diff --git a/desktop/win32/source/extendloaderenvironment.cxx b/desktop/win32/source/extendloaderenvironment.cxx
index 2292e9266b..5918dadff8 100644
--- a/desktop/win32/source/extendloaderenvironment.cxx
+++ b/desktop/win32/source/extendloaderenvironment.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: extendloaderenvironment.cxx,v $
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
* This file is part of OpenOffice.org.
*
@@ -93,11 +93,11 @@ void extendLoaderEnvironment(WCHAR * binPath, WCHAR * iniDirectory) {
if (!GetModuleFileNameW(NULL, iniDirectory, MAX_PATH)) {
fail();
}
- WCHAR * pathEnd = tools::filename(iniDirectory);
+ WCHAR * iniDirEnd = tools::filename(iniDirectory);
WCHAR name[MAX_PATH + MY_LENGTH(L".bin")];
// hopefully std::size_t is large enough to not overflow
WCHAR * nameEnd = name;
- for (WCHAR * p = pathEnd; *p != L'\0'; ++p) {
+ for (WCHAR * p = iniDirEnd; *p != L'\0'; ++p) {
*nameEnd++ = *p;
}
if (!(nameEnd - name >= 4 && nameEnd[-4] == L'.' &&
@@ -111,33 +111,43 @@ void extendLoaderEnvironment(WCHAR * binPath, WCHAR * iniDirectory) {
nameEnd[-3] = 'b';
nameEnd[-2] = 'i';
nameEnd[-1] = 'n';
- tools::buildPath(binPath, iniDirectory, pathEnd, name, nameEnd - name);
- *pathEnd = L'\0';
+ tools::buildPath(binPath, iniDirectory, iniDirEnd, name, nameEnd - name);
+ *iniDirEnd = L'\0';
WCHAR path[MAX_PATH];
- pathEnd = tools::buildPath(
- path, iniDirectory, pathEnd, MY_STRING(L"..\\basis-link"));
- if (pathEnd == NULL) {
- fail();
- }
- pathEnd = tools::resolveLink(path);
+ WCHAR * pathEnd = tools::buildPath(
+ path, iniDirectory, iniDirEnd, MY_STRING(L"..\\basis-link"));
if (pathEnd == NULL) {
fail();
}
std::size_t const maxEnv = 32767;
WCHAR pad[2 * MAX_PATH + maxEnv];
// hopefully std::size_t is large enough to not overflow
- WCHAR * padEnd = tools::buildPath(
- pad, path, pathEnd, MY_STRING(L"\\program"));
- if (padEnd == NULL) {
- fail();
- }
+ WCHAR * padEnd = NULL;
WCHAR env[maxEnv];
DWORD n = GetEnvironmentVariableW(L"PATH", env, maxEnv);
if (n >= maxEnv || n == 0 && GetLastError() != ERROR_ENVVAR_NOT_FOUND) {
fail();
}
env[n] = L'\0';
- bool exclude1 = contains(env, pad, padEnd);
+ bool exclude1;
+ pathEnd = tools::resolveLink(path);
+ if (pathEnd == NULL) {
+ if (GetLastError() != ERROR_FILE_NOT_FOUND) {
+ fail();
+ }
+ pathEnd = tools::buildPath(
+ path, iniDirectory, iniDirEnd, MY_STRING(L".."));
+ if (pathEnd == NULL) {
+ fail();
+ }
+ exclude1 = true;
+ } else {
+ padEnd = tools::buildPath(pad, path, pathEnd, MY_STRING(L"\\program"));
+ if (padEnd == NULL) {
+ fail();
+ }
+ exclude1 = contains(env, pad, padEnd);
+ }
WCHAR * pad2 = exclude1 ? pad : padEnd + 1;
pathEnd = tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link"));
if (pathEnd == NULL) {