| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/install_static/install_util.h" | 5 #include "chrome/install_static/install_util.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <assert.h> | 8 #include <assert.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iostream> | 10 #include <iostream> |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return std::wstring(); | 184 return std::wstring(); |
| 185 return exe_path; | 185 return exe_path; |
| 186 } | 186 } |
| 187 | 187 |
| 188 bool RecursiveDirectoryCreate(const std::wstring& full_path) { | 188 bool RecursiveDirectoryCreate(const std::wstring& full_path) { |
| 189 // If the path exists, we've succeeded if it's a directory, failed otherwise. | 189 // If the path exists, we've succeeded if it's a directory, failed otherwise. |
| 190 const wchar_t* full_path_str = full_path.c_str(); | 190 const wchar_t* full_path_str = full_path.c_str(); |
| 191 DWORD file_attributes = ::GetFileAttributes(full_path_str); | 191 DWORD file_attributes = ::GetFileAttributes(full_path_str); |
| 192 if (file_attributes != INVALID_FILE_ATTRIBUTES) { | 192 if (file_attributes != INVALID_FILE_ATTRIBUTES) { |
| 193 if ((file_attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { | 193 if ((file_attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { |
| 194 Trace(L"%hs( %ls directory exists )\n", __FUNCTION__, full_path_str); | 194 Trace(L"%hs( %ls directory exists )\n", __func__, full_path_str); |
| 195 return true; | 195 return true; |
| 196 } | 196 } |
| 197 Trace(L"%hs( %ls directory conflicts with an existing file. )\n", | 197 Trace(L"%hs( %ls directory conflicts with an existing file. )\n", __func__, |
| 198 __FUNCTION__, full_path_str); | 198 full_path_str); |
| 199 return false; | 199 return false; |
| 200 } | 200 } |
| 201 | 201 |
| 202 // Invariant: Path does not exist as file or directory. | 202 // Invariant: Path does not exist as file or directory. |
| 203 | 203 |
| 204 // Attempt to create the parent recursively. This will immediately return | 204 // Attempt to create the parent recursively. This will immediately return |
| 205 // true if it already exists, otherwise will create all required parent | 205 // true if it already exists, otherwise will create all required parent |
| 206 // directories starting with the highest-level missing parent. | 206 // directories starting with the highest-level missing parent. |
| 207 std::wstring parent_path; | 207 std::wstring parent_path; |
| 208 std::size_t pos = full_path.find_last_of(L"/\\"); | 208 std::size_t pos = full_path.find_last_of(L"/\\"); |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 switch_value_end_offset = command_line_copy.length(); | 849 switch_value_end_offset = command_line_copy.length(); |
| 850 | 850 |
| 851 std::string switch_value = command_line_copy.substr( | 851 std::string switch_value = command_line_copy.substr( |
| 852 switch_value_start_offset, | 852 switch_value_start_offset, |
| 853 switch_value_end_offset - (switch_offset + switch_token.length())); | 853 switch_value_end_offset - (switch_offset + switch_token.length())); |
| 854 TrimT<std::string>(&switch_value); | 854 TrimT<std::string>(&switch_value); |
| 855 return switch_value; | 855 return switch_value; |
| 856 } | 856 } |
| 857 | 857 |
| 858 } // namespace install_static | 858 } // namespace install_static |
| OLD | NEW |