diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-25 01:51:44 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-25 01:51:44 +0000 |
commit | fd061a6017827421b66782eb576b480b939627e3 (patch) | |
tree | 8835b25d3a9a5546ef9d9d748ff7fd35234d00c0 /base | |
parent | 7dc21e5c1d739c3c263abaf86b953a4d022ba538 (diff) | |
download | chromium_src-fd061a6017827421b66782eb576b480b939627e3.zip chromium_src-fd061a6017827421b66782eb576b480b939627e3.tar.gz chromium_src-fd061a6017827421b66782eb576b480b939627e3.tar.bz2 |
Remove uses of deprecated version of FileUtil::ResolveShortcut.
BUG=None
TEST=run base_unittests.exe
Review URL: http://codereview.chromium.org/173181
Patch from Thiago Farina <thiago.farina@gmail.com>.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/file_util.h | 7 | ||||
-rw-r--r-- | base/file_util_unittest.cc | 11 | ||||
-rw-r--r-- | base/file_util_win.cc | 7 |
3 files changed, 8 insertions, 17 deletions
diff --git a/base/file_util.h b/base/file_util.h index 1c1a79f..cbca470 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -229,11 +229,10 @@ bool ReadFromFD(int fd, char* buffer, size_t bytes); #if defined(OS_WIN) // Resolve Windows shortcut (.LNK file) -// Argument path specifies a valid LNK file. On success, return true and put -// the URL into path. If path is a invalid .LNK file, return false. +// This methods tries to resolve a shortcut .LNK file. If the |path| is valid +// returns true and puts the target into the |path|, otherwise returns +// false leaving the path as it is. bool ResolveShortcut(FilePath* path); -// Deprecated temporary compatibility function. -bool ResolveShortcut(std::wstring* path); // Create a Windows shortcut (.LNK file) // This method creates a shortcut link using the information given. Ensure diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index b1f7822..cf9dda1 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -712,16 +712,15 @@ TEST_F(FileUtilTest, ResolveShortcutTest) { shell->Release(); bool is_solved; - std::wstring link_file_str = link_file.value(); - is_solved = file_util::ResolveShortcut(&link_file_str); + is_solved = file_util::ResolveShortcut(&link_file); EXPECT_TRUE(is_solved); std::wstring contents; - contents = ReadTextFile(FilePath(link_file_str)); + contents = ReadTextFile(link_file); EXPECT_EQ(L"This is the target.", contents); // Cleaning DeleteFile(target_file.value().c_str()); - DeleteFile(link_file_str.c_str()); + DeleteFile(link_file.value().c_str()); CoUninitialize(); } @@ -736,9 +735,9 @@ TEST_F(FileUtilTest, CreateShortcutTest) { EXPECT_TRUE(file_util::CreateShortcutLink(target_file.value().c_str(), link_file.value().c_str(), NULL, NULL, NULL, NULL, 0)); - std::wstring resolved_name = link_file.value(); + FilePath resolved_name = link_file; EXPECT_TRUE(file_util::ResolveShortcut(&resolved_name)); - std::wstring read_contents = ReadTextFile(FilePath(resolved_name)); + std::wstring read_contents = ReadTextFile(resolved_name); EXPECT_EQ(file_contents, read_contents); DeleteFile(target_file.value().c_str()); diff --git a/base/file_util_win.cc b/base/file_util_win.cc index cffe72e..0acaf5f 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -254,13 +254,6 @@ bool GetFileCreationLocalTime(const std::wstring& filename, return GetFileCreationLocalTimeFromHandle(file_handle.Get(), creation_time); } -bool ResolveShortcut(std::wstring* path) { - FilePath file_path(*path); - bool result = ResolveShortcut(&file_path); - *path = file_path.value(); - return result; -} - bool ResolveShortcut(FilePath* path) { HRESULT result; IShellLink *shell = NULL; |