Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: chrome/installer/setup/setup_util.cc

Issue 118247: Add project for setup unittests (Closed)
Patch Set: fix tab char Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // This file declares util functions for setup project.
6
7 #include "chrome/installer/setup/setup_util.h"
8
9 #include "base/file_util.h"
10 #include "base/logging.h"
11
12 installer::Version* setup_util::GetVersionFromDir(
13 const std::wstring& chrome_path) {
14 LOG(INFO) << "Looking for Chrome version folder under " << chrome_path;
15 std::wstring root_path(chrome_path);
16 file_util::AppendToPath(&root_path, L"*");
17
18 WIN32_FIND_DATA find_data;
19 HANDLE file_handle = FindFirstFile(root_path.c_str(), &find_data);
20 BOOL ret = TRUE;
21 installer::Version *version = NULL;
22 // Here we are assuming that the installer we have is really valid so there
23 // can not be two version directories. We exit as soon as we find a valid
24 // version directory.
25 while (ret) {
26 if (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
27 LOG(INFO) << "directory found: " << find_data.cFileName;
28 version = installer::Version::GetVersionFromString(find_data.cFileName);
29 if (version) break;
30 }
31 ret = FindNextFile(file_handle, &find_data);
32 }
33 FindClose(file_handle);
34
35 return version;
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698