From 561abe688fc5ebcec902ea6cc2ccb4122441595e Mon Sep 17 00:00:00 2001 From: "avi@chromium.org" Date: Mon, 6 Apr 2009 18:08:34 +0000 Subject: First pass of refactoring dialogs. Review URL: http://codereview.chromium.org/60110 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13168 0039d316-1c4b-4281-b951-d872f2087c98 --- base/file_util.h | 2 ++ base/file_util_win.cc | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'base') diff --git a/base/file_util.h b/base/file_util.h index 43c31f5..6c916dd 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -225,6 +225,8 @@ bool ReadFileToString(const std::wstring& path, std::string* contents); // 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. +bool ResolveShortcut(FilePath* path); +// Deprecated temporary compatibility function. bool ResolveShortcut(std::wstring* path); // Create a Windows shortcut (.LNK file) diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 45c0afde..841cd28 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -240,6 +240,13 @@ bool GetFileCreationLocalTime(const std::wstring& filename, } 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; bool is_resolved = false; @@ -256,14 +263,14 @@ bool ResolveShortcut(std::wstring* path) { if (SUCCEEDED(result)) { WCHAR temp_path[MAX_PATH]; // Load the shell link - result = persist->Load(path->c_str(), STGM_READ); + result = persist->Load(path->value().c_str(), STGM_READ); if (SUCCEEDED(result)) { // Try to find the target of a shortcut result = shell->Resolve(0, SLR_NO_UI); if (SUCCEEDED(result)) { result = shell->GetPath(temp_path, MAX_PATH, NULL, SLGP_UNCPRIORITY); - *path = temp_path; + *path = FilePath(temp_path); is_resolved = true; } } -- cgit v1.1