| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/chromeos/drive/file_system_util.h" | 5 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 // Moves all files under |directory_from| to |directory_to|. | 108 // Moves all files under |directory_from| to |directory_to|. |
| 109 void MoveAllFilesFromDirectory(const base::FilePath& directory_from, | 109 void MoveAllFilesFromDirectory(const base::FilePath& directory_from, |
| 110 const base::FilePath& directory_to) { | 110 const base::FilePath& directory_to) { |
| 111 base::FileEnumerator enumerator(directory_from, false, // not recursive | 111 base::FileEnumerator enumerator(directory_from, false, // not recursive |
| 112 base::FileEnumerator::FILES); | 112 base::FileEnumerator::FILES); |
| 113 for (base::FilePath file_from = enumerator.Next(); !file_from.empty(); | 113 for (base::FilePath file_from = enumerator.Next(); !file_from.empty(); |
| 114 file_from = enumerator.Next()) { | 114 file_from = enumerator.Next()) { |
| 115 const base::FilePath file_to = directory_to.Append(file_from.BaseName()); | 115 const base::FilePath file_to = directory_to.Append(file_from.BaseName()); |
| 116 if (!file_util::PathExists(file_to)) // Do not overwrite existing files. | 116 if (!file_util::PathExists(file_to)) // Do not overwrite existing files. |
| 117 file_util::Move(file_from, file_to); | 117 base::Move(file_from, file_to); |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace | 121 } // namespace |
| 122 | 122 |
| 123 const base::FilePath& GetDriveGrandRootPath() { | 123 const base::FilePath& GetDriveGrandRootPath() { |
| 124 CR_DEFINE_STATIC_LOCAL(base::FilePath, grand_root_path, | 124 CR_DEFINE_STATIC_LOCAL(base::FilePath, grand_root_path, |
| 125 (util::kDriveGrandRootDirName)); | 125 (util::kDriveGrandRootDirName)); |
| 126 return grand_root_path; | 126 return grand_root_path; |
| 127 } | 127 } |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 GURL ReadUrlFromGDocFile(const base::FilePath& file_path) { | 434 GURL ReadUrlFromGDocFile(const base::FilePath& file_path) { |
| 435 return GURL(ReadStringFromGDocFile(file_path, "url")); | 435 return GURL(ReadStringFromGDocFile(file_path, "url")); |
| 436 } | 436 } |
| 437 | 437 |
| 438 std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path) { | 438 std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path) { |
| 439 return ReadStringFromGDocFile(file_path, "resource_id"); | 439 return ReadStringFromGDocFile(file_path, "resource_id"); |
| 440 } | 440 } |
| 441 | 441 |
| 442 } // namespace util | 442 } // namespace util |
| 443 } // namespace drive | 443 } // namespace drive |
| OLD | NEW |