Chromium Code Reviews| Index: components/nacl/browser/nacl_process_host.cc |
| diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc |
| index a5a1341dcfb16c65a3bcc8baf41eccd24c8c6b65..31486fbfc2be38ebf86441949a1a480df81aeae2 100644 |
| --- a/components/nacl/browser/nacl_process_host.cc |
| +++ b/components/nacl/browser/nacl_process_host.cc |
| @@ -512,6 +512,33 @@ bool NaClProcessHost::LaunchSelLdr() { |
| SendErrorToRenderer("could not get path to nacl64.exe"); |
| return false; |
| } |
| + |
| +#ifdef _DLL |
| + // When using the DLL CRT on Windows, we need to amend the PATH to include |
| + // the location of the x64 CRT DLLs. This is only the case when using a |
| + // component=shared_library build (i.e. generally dev debug builds). The |
| + // x86 CRT DLLs are in e.g. out\Debug for chrome.exe etc., so the x64 ones |
| + // are put in out\Debug\x64 which we add to the PATH here so that loader |
| + // can find them. See http://crbug.com/346034. |
| + scoped_ptr<base::Environment> env(base::Environment::Create()); |
| + static const char kPath[] = "PATH"; |
| + std::string old_path; |
| + base::FilePath module_path; |
| + if (!PathService::Get(base::FILE_MODULE, &module_path)) { |
| + SendErrorToRenderer("could not get path to current module"); |
| + return false; |
| + } |
| + std::string x64_crt_path = |
| + base::WideToUTF8(module_path.DirName().Append(L"x64").value()); |
| + if (!env->GetVar(kPath, &old_path)) { |
| + env->SetVar(kPath, x64_crt_path); |
| + } else if (old_path.find(x64_crt_path) == std::string::npos) { |
|
Mark Seaborn
2014/02/26 02:24:50
This is a bit icky because it matches any substrin
scottmg
2014/02/26 04:27:59
I admit I considered that when writing it and deci
|
| + std::string new_path(old_path); |
| + new_path.append(";"); |
| + new_path.append(x64_crt_path); |
| + env->SetVar(kPath, new_path); |
| + } |
| +#endif // _DLL |
| } |
| #endif |