| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <shlobj.h> | 9 #include <shlobj.h> |
| 10 #include <time.h> | 10 #include <time.h> |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 i_shell_link->Release(); | 358 i_shell_link->Release(); |
| 359 return false; | 359 return false; |
| 360 } | 360 } |
| 361 | 361 |
| 362 HRESULT result = i_persist_file->Save(destination, TRUE); | 362 HRESULT result = i_persist_file->Save(destination, TRUE); |
| 363 i_persist_file->Release(); | 363 i_persist_file->Release(); |
| 364 i_shell_link->Release(); | 364 i_shell_link->Release(); |
| 365 return SUCCEEDED(result); | 365 return SUCCEEDED(result); |
| 366 } | 366 } |
| 367 | 367 |
| 368 bool IsDirectoryEmpty(const std::wstring& dir_path) { |
| 369 FileEnumerator files(dir_path, false, FileEnumerator::FILES_AND_DIRECTORIES); |
| 370 if (files.Next().empty()) |
| 371 return true; |
| 372 return false; |
| 373 } |
| 374 |
| 368 bool GetTempDir(std::wstring* path) { | 375 bool GetTempDir(std::wstring* path) { |
| 369 wchar_t temp_path[MAX_PATH + 1]; | 376 wchar_t temp_path[MAX_PATH + 1]; |
| 370 DWORD path_len = ::GetTempPath(MAX_PATH, temp_path); | 377 DWORD path_len = ::GetTempPath(MAX_PATH, temp_path); |
| 371 if (path_len >= MAX_PATH || path_len <= 0) | 378 if (path_len >= MAX_PATH || path_len <= 0) |
| 372 return false; | 379 return false; |
| 373 path->assign(temp_path); | 380 path->assign(temp_path); |
| 374 TrimTrailingSeparator(path); | 381 TrimTrailingSeparator(path); |
| 375 return true; | 382 return true; |
| 376 } | 383 } |
| 377 | 384 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 return (file_type_ & FileEnumerator::DIRECTORIES) ? cur_file : Next(); | 663 return (file_type_ & FileEnumerator::DIRECTORIES) ? cur_file : Next(); |
| 657 } | 664 } |
| 658 | 665 |
| 659 if ((file_type_ & FileEnumerator::DIRECTORIES) == 0) | 666 if ((file_type_ & FileEnumerator::DIRECTORIES) == 0) |
| 660 return Next(); | 667 return Next(); |
| 661 } | 668 } |
| 662 return (file_type_ & FileEnumerator::FILES) ? cur_file : Next(); | 669 return (file_type_ & FileEnumerator::FILES) ? cur_file : Next(); |
| 663 } | 670 } |
| 664 | 671 |
| 665 } // namespace file_util | 672 } // namespace file_util |
| OLD | NEW |