diff options
author | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 01:02:05 +0000 |
---|---|---|
committer | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 01:02:05 +0000 |
commit | 2ad02d31b833d0d386fb8311bb877cf8927994df (patch) | |
tree | 4eb3206399e9749697459d55fdbb738304aee6ab /chrome/common | |
parent | d13e7bfb79721a529c373d8c0e121f4055b0f6d8 (diff) | |
download | chromium_src-2ad02d31b833d0d386fb8311bb877cf8927994df.zip chromium_src-2ad02d31b833d0d386fb8311bb877cf8927994df.tar.gz chromium_src-2ad02d31b833d0d386fb8311bb877cf8927994df.tar.bz2 |
Ensure that the directory has a trailing separator when highlighting
a file in Windows Explorer. IShellFolder::ParseDisplayName will fail
when the directory is a raw drive letter like "C:" instead of "C:\\".
This situation can occur if a user downloads a file to the "C:"
directory and then attempts to run the UI command "Show in folder".
BUG = http://crbug.com/4396
Review URL: http://codereview.chromium.org/14030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6859 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/win_util.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/chrome/common/win_util.cc b/chrome/common/win_util.cc index 4cfec85..48f29df 100644 --- a/chrome/common/win_util.cc +++ b/chrome/common/win_util.cc @@ -161,6 +161,11 @@ void ShowItemInFolder(const std::wstring& full_path) { if (dir == L"" || !file_util::PathExists(full_path)) return; + // ParseDisplayName will fail if the directory is "C:", it must be "C:\\". + FilePath dir_path(dir); + file_util::EnsureEndsWithSeparator(&dir_path); + dir = dir_path.value(); + typedef HRESULT (WINAPI *SHOpenFolderAndSelectItemsFuncPtr)( PCIDLIST_ABSOLUTE pidl_Folder, UINT cidl, |