| 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 for (int i = 0; i < 3 && tokenizer.GetNext(); i++) { | 97 // TODO(rkc): Ignore the 0. here; fix this once we move Chrome OS version |
| 98 if (0 == i) { | 98 // numbers from the 0.xx.yyy.zz format to the xx.yyy.zz format. |
| 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) { |
| 99 StringToInt(tokenizer.token_begin(), | 102 StringToInt(tokenizer.token_begin(), |
| 100 tokenizer.token_end(), | 103 tokenizer.token_end(), |
| 101 major_version); | 104 major_version); |
| 102 *minor_version = *bugfix_version = 0; | 105 *minor_version = *bugfix_version = 0; |
| 103 } else if (1 == i) { | 106 } else if (2 == i) { |
| 104 StringToInt(tokenizer.token_begin(), | 107 StringToInt(tokenizer.token_begin(), |
| 105 tokenizer.token_end(), | 108 tokenizer.token_end(), |
| 106 minor_version); | 109 minor_version); |
| 107 } else { // 2 == i | 110 } else { // 3 == i |
| 108 StringToInt(tokenizer.token_begin(), | 111 StringToInt(tokenizer.token_begin(), |
| 109 tokenizer.token_end(), | 112 tokenizer.token_end(), |
| 110 bugfix_version); | 113 bugfix_version); |
| 111 } | 114 } |
| 112 } | 115 } |
| 113 } | 116 } |
| 114 | 117 |
| 115 } // namespace base | 118 } // namespace base |
| OLD | NEW |