OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/sys_info.h" | 5 #include "base/sys_info.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 87 } |
88 if (std::string::npos == version_key_index) { | 88 if (std::string::npos == version_key_index) { |
89 return; | 89 return; |
90 } | 90 } |
91 | 91 |
92 size_t start_index = lsb_release.find_first_of('=', version_key_index); | 92 size_t start_index = lsb_release.find_first_of('=', version_key_index); |
93 start_index++; // Move past '='. | 93 start_index++; // Move past '='. |
94 size_t length = lsb_release.find_first_of('\n', start_index) - start_index; | 94 size_t length = lsb_release.find_first_of('\n', start_index) - start_index; |
95 std::string version = lsb_release.substr(start_index, length); | 95 std::string version = lsb_release.substr(start_index, length); |
96 StringTokenizer tokenizer(version, "."); | 96 StringTokenizer tokenizer(version, "."); |
97 // TODO(rkc): Ignore the 0. here; fix this once we move Chrome OS version | 97 for (int i = 0; i < 3 && tokenizer.GetNext(); i++) { |
98 // numbers from the 0.xx.yyy.zz format to the xx.yyy.zz format. | 98 if (0 == i) { |
99 // Refer to http://code.google.com/p/chromium-os/issues/detail?id=15789 | |
100 for (int i = 0; i < 4 && tokenizer.GetNext(); i++) { | |
101 if (1 == i) { | |
102 StringToInt(tokenizer.token_begin(), | 99 StringToInt(tokenizer.token_begin(), |
103 tokenizer.token_end(), | 100 tokenizer.token_end(), |
104 major_version); | 101 major_version); |
105 *minor_version = *bugfix_version = 0; | 102 *minor_version = *bugfix_version = 0; |
106 } else if (2 == i) { | 103 } else if (1 == i) { |
107 StringToInt(tokenizer.token_begin(), | 104 StringToInt(tokenizer.token_begin(), |
108 tokenizer.token_end(), | 105 tokenizer.token_end(), |
109 minor_version); | 106 minor_version); |
110 } else { // 3 == i | 107 } else { // 2 == i |
111 StringToInt(tokenizer.token_begin(), | 108 StringToInt(tokenizer.token_begin(), |
112 tokenizer.token_end(), | 109 tokenizer.token_end(), |
113 bugfix_version); | 110 bugfix_version); |
114 } | 111 } |
115 } | 112 } |
116 } | 113 } |
117 | 114 |
118 } // namespace base | 115 } // namespace base |
OLD | NEW |