Skip to content

Commit

Permalink
Extend PathService::Get to be able to return the X86 program files path.
Browse files Browse the repository at this point in the history
Cloud print's virtual driver needs this to be able to find the Chrome install directory.  Since the port monitor is a 64 bit DLL on 64 bit Windows it needs to request the X86 folder explicitly.


BUG=
TEST=

Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=82567

Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=82686

Review URL: http://codereview.chromium.org/6873159

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82891 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
abodenha@chromium.org committed Apr 25, 2011
1 parent 0a87625 commit 9759ffc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
12 changes: 11 additions & 1 deletion base/base_paths_win.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand Down Expand Up @@ -49,6 +49,16 @@ bool PathProviderWin(int key, FilePath* result) {
GetSystemDirectory(system_buffer, MAX_PATH);
cur = FilePath(system_buffer);
break;
case base::DIR_PROGRAM_FILESX86:
if (base::win::OSInfo::GetInstance()->architecture() !=
base::win::OSInfo::X86_ARCHITECTURE) {
if (FAILED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILESX86, NULL,
SHGFP_TYPE_CURRENT, system_buffer)))
return false;
cur = FilePath(system_buffer);
break;
}
// Fall through to base::DIR_PROGRAM_FILES if we're on an X86 machine.
case base::DIR_PROGRAM_FILES:
if (FAILED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL,
SHGFP_TYPE_CURRENT, system_buffer)))
Expand Down
5 changes: 3 additions & 2 deletions base/base_paths_win.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand All @@ -17,7 +17,8 @@ enum {

DIR_WINDOWS, // Windows directory, usually "c:\windows"
DIR_SYSTEM, // Usually c:\windows\system32"
DIR_PROGRAM_FILES, // Usually c:\program files
DIR_PROGRAM_FILES, // Usually c:\program files
DIR_PROGRAM_FILESX86, // Usually c:\program files or c:\program files (x86)

DIR_IE_INTERNET_CACHE, // Temporary Internet Files directory.
DIR_COMMON_START_MENU, // Usually "C:\Documents and Settings\All Users\
Expand Down
11 changes: 1 addition & 10 deletions cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,7 @@ bool GetChromeExePath(FilePath* chrome_path) {

// Chrome doesn't appear to be installed per user.
// Now check %programfiles(x86)%\google\chrome\application
// TODO(abodenha@chromium.org) Extend PathService::Get to be able to
// return the X86 program files path. At a minimum, use SHGetKnownFolderPath
// instead.
wchar_t system_buffer[MAX_PATH] = L"";
SHGetFolderPath(NULL,
CSIDL_PROGRAM_FILESX86,
NULL,
SHGFP_TYPE_CURRENT,
system_buffer);
path = FilePath(system_buffer);
PathService::Get(base::DIR_PROGRAM_FILESX86, &path);
path = path.Append(kChromeExePath);
if (file_util::PathExists(path)) {
*chrome_path = FilePath(path.value());
Expand Down

0 comments on commit 9759ffc

Please sign in to comment.