diff options
Diffstat (limited to 'chrome/installer/util/helper.cc')
-rw-r--r-- | chrome/installer/util/helper.cc | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/chrome/installer/util/helper.cc b/chrome/installer/util/helper.cc index a2038c4..af18e9e 100644 --- a/chrome/installer/util/helper.cc +++ b/chrome/installer/util/helper.cc @@ -18,8 +18,8 @@ namespace { -FilePath GetChromeInstallBasePath(bool system_install, - const wchar_t* subpath) { +std::wstring GetChromeInstallBasePath(bool system_install, + const wchar_t* subpath) { FilePath install_path; if (system_install) { PathService::Get(base::DIR_PROGRAM_FILES, &install_path); @@ -31,42 +31,41 @@ FilePath GetChromeInstallBasePath(bool system_install, install_path = install_path.Append(dist->GetInstallSubDir()); install_path = install_path.Append(subpath); } - return install_path; + return install_path.ToWStringHack(); } } // namespace -FilePath installer::GetChromeInstallPath(bool system_install) { +std::wstring installer::GetChromeInstallPath(bool system_install) { return GetChromeInstallBasePath(system_install, installer_util::kInstallBinaryDir); } -FilePath installer::GetChromeUserDataPath() { +std::wstring installer::GetChromeUserDataPath() { return GetChromeInstallBasePath(false, installer_util::kInstallUserDataDir); } bool installer::LaunchChrome(bool system_install) { - FilePath chrome_exe(FILE_PATH_LITERAL("\"")); - chrome_exe = chrome_exe.Append(installer::GetChromeInstallPath( - system_install)); - chrome_exe = chrome_exe.Append(installer_util::kChromeExe); - chrome_exe = chrome_exe.Append(FILE_PATH_LITERAL("\"")); - return base::LaunchApp(chrome_exe.value(), false, false, NULL); + std::wstring chrome_exe(L"\""); + chrome_exe.append(installer::GetChromeInstallPath(system_install)); + file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); + chrome_exe.append(L"\""); + return base::LaunchApp(chrome_exe, false, false, NULL); } bool installer::LaunchChromeAndWaitForResult(bool system_install, const std::wstring& options, int32* exit_code) { - FilePath chrome_exe(installer::GetChromeInstallPath(system_install)); + std::wstring chrome_exe(installer::GetChromeInstallPath(system_install)); if (chrome_exe.empty()) return false; - chrome_exe = chrome_exe.Append(installer_util::kChromeExe); + file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); - std::wstring command_line(L"\"" + chrome_exe.value() + L"\""); + std::wstring command_line(L"\"" + chrome_exe + L"\""); command_line.append(options); STARTUPINFOW si = {sizeof(si)}; PROCESS_INFORMATION pi = {0}; - if (!::CreateProcessW(chrome_exe.value().c_str(), + if (!::CreateProcessW(chrome_exe.c_str(), const_cast<wchar_t*>(command_line.c_str()), NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { @@ -86,13 +85,13 @@ bool installer::LaunchChromeAndWaitForResult(bool system_install, return true; } -void installer::RemoveOldVersionDirs(const FilePath& chrome_path, +void installer::RemoveOldVersionDirs(const std::wstring& chrome_path, const std::wstring& latest_version_str) { - FilePath search_path(chrome_path.AppendASCII("*")); + std::wstring search_path(chrome_path); + file_util::AppendToPath(&search_path, L"*"); WIN32_FIND_DATA find_file_data; - HANDLE file_handle = FindFirstFile(search_path.value().c_str(), - &find_file_data); + HANDLE file_handle = FindFirstFile(search_path.c_str(), &find_file_data); if (file_handle == INVALID_HANDLE_VALUE) return; @@ -109,9 +108,11 @@ void installer::RemoveOldVersionDirs(const FilePath& chrome_path, version.reset( installer::Version::GetVersionFromString(find_file_data.cFileName)); if (version.get() && latest_version->IsHigherThan(version.get())) { - FilePath remove_dir(chrome_path.Append(find_file_data.cFileName)); - FilePath chrome_dll_path(remove_dir.Append(installer_util::kChromeDll)); - LOG(INFO) << "deleting directory " << remove_dir.value(); + std::wstring remove_dir(chrome_path); + file_util::AppendToPath(&remove_dir, find_file_data.cFileName); + std::wstring chrome_dll_path(remove_dir); + file_util::AppendToPath(&chrome_dll_path, installer_util::kChromeDll); + LOG(INFO) << "deleting directory " << remove_dir; scoped_ptr<DeleteTreeWorkItem> item; item.reset(WorkItem::CreateDeleteTreeWorkItem(remove_dir, chrome_dll_path)); |