OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 #include <algorithm> | 6 #include <algorithm> |
7 | 7 |
8 #include "net/socket/ssl_test_util.h" | 8 #include "net/socket/ssl_test_util.h" |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 namespace { | 171 namespace { |
172 | 172 |
173 void AppendToPythonPath(const FilePath& dir) { | 173 void AppendToPythonPath(const FilePath& dir) { |
174 // Do nothing if dir already on path. | 174 // Do nothing if dir already on path. |
175 | 175 |
176 #if defined(OS_WIN) | 176 #if defined(OS_WIN) |
177 const wchar_t kPythonPath[] = L"PYTHONPATH"; | 177 const wchar_t kPythonPath[] = L"PYTHONPATH"; |
178 // FIXME(dkegel): handle longer PYTHONPATH variables | 178 // FIXME(dkegel): handle longer PYTHONPATH variables |
179 wchar_t oldpath[4096]; | 179 wchar_t oldpath[4096]; |
180 if (GetEnvironmentVariable(kPythonPath, oldpath, sizeof(oldpath)) == 0) { | 180 if (GetEnvironmentVariable(kPythonPath, oldpath, arraysize(oldpath)) == 0) { |
181 SetEnvironmentVariableW(kPythonPath, dir.value().c_str()); | 181 SetEnvironmentVariableW(kPythonPath, dir.value().c_str()); |
182 } else if (!wcsstr(oldpath, dir.value().c_str())) { | 182 } else if (!wcsstr(oldpath, dir.value().c_str())) { |
183 std::wstring newpath(oldpath); | 183 std::wstring newpath(oldpath); |
184 newpath.append(L":"); | 184 newpath.append(L":"); |
185 newpath.append(dir.value()); | 185 newpath.append(dir.value()); |
186 SetEnvironmentVariableW(kPythonPath, newpath.c_str()); | 186 SetEnvironmentVariableW(kPythonPath, newpath.c_str()); |
187 } | 187 } |
188 #elif defined(OS_POSIX) | 188 #elif defined(OS_POSIX) |
189 const char kPythonPath[] = "PYTHONPATH"; | 189 const char kPythonPath[] = "PYTHONPATH"; |
190 const char* oldpath = getenv(kPythonPath); | 190 const char* oldpath = getenv(kPythonPath); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 "certificate to your trusted roots for this test to work. " | 432 "certificate to your trusted roots for this test to work. " |
433 "For more info visit:\n" | 433 "For more info visit:\n" |
434 "http://dev.chromium.org/developers/testing\n"; | 434 "http://dev.chromium.org/developers/testing\n"; |
435 return false; | 435 return false; |
436 } | 436 } |
437 #endif | 437 #endif |
438 return true; | 438 return true; |
439 } | 439 } |
440 | 440 |
441 } // namespace net | 441 } // namespace net |
OLD | NEW |