Skip to content

Commit 043355b

Browse files
hschamCommit Bot
hscham
authored and
Commit Bot
committed
update_engine: use new base::Delete{File,PathRecursively}
base::DeleteFile(const FilePath& path, bool recursive) would be deprecated in next libchrome uprev. BUG=chromium:1144735 TEST=cros_run_unit_tests --board=eve --packages update_engine Change-Id: Iaeac97f533a156c2c29f7ba53755664d6591b0a1 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2543515 Tested-by: Grace Cham <[email protected]> Reviewed-by: Amin Hassani <[email protected]> Reviewed-by: Hidehiko Abe <[email protected]> Commit-Queue: Grace Cham <[email protected]>
1 parent 606abc9 commit 043355b

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

common/prefs.cc

+8
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ void DeleteEmptyDirectories(const base::FilePath& path) {
4141
dir_path = path_enum.Next()) {
4242
DeleteEmptyDirectories(dir_path);
4343
if (base::IsDirectoryEmpty(dir_path))
44+
#if BASE_VER < 800000
4445
base::DeleteFile(dir_path, false);
46+
#else
47+
base::DeleteFile(dir_path);
48+
#endif
4549
}
4650
}
4751

@@ -210,7 +214,11 @@ bool Prefs::FileStorage::KeyExists(const string& key) const {
210214
bool Prefs::FileStorage::DeleteKey(const string& key) {
211215
base::FilePath filename;
212216
TEST_AND_RETURN_FALSE(GetFileNameForKey(key, &filename));
217+
#if BASE_VER < 800000
213218
TEST_AND_RETURN_FALSE(base::DeleteFile(filename, false));
219+
#else
220+
TEST_AND_RETURN_FALSE(base::DeleteFile(filename));
221+
#endif
214222
return true;
215223
}
216224

cros/hardware_chromeos.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ bool HardwareChromeOS::SchedulePowerwash(bool save_rollback_data) {
253253
}
254254

255255
bool HardwareChromeOS::CancelPowerwash() {
256-
bool result = base::DeleteFile(base::FilePath(kPowerwashMarkerFile), false);
256+
bool result = base::DeleteFile(base::FilePath(kPowerwashMarkerFile));
257257

258258
if (result) {
259259
LOG(INFO) << "Successfully deleted the powerwash marker file : "
@@ -264,7 +264,7 @@ bool HardwareChromeOS::CancelPowerwash() {
264264
}
265265

266266
// Delete the rollback save marker file if it existed.
267-
if (!base::DeleteFile(base::FilePath(kRollbackSaveMarkerFile), false)) {
267+
if (!base::DeleteFile(base::FilePath(kRollbackSaveMarkerFile))) {
268268
PLOG(ERROR) << "Could not remove rollback save marker";
269269
}
270270

cros/logging.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void SetupLogSymlink(const string& symlink_path, const string& log_path) {
4646
base::ReplaceFile(
4747
base::FilePath(symlink_path), base::FilePath(log_path), nullptr);
4848
}
49-
base::DeleteFile(base::FilePath(symlink_path), true);
49+
base::DeletePathRecursively(base::FilePath(symlink_path));
5050
if (symlink(log_path.c_str(), symlink_path.c_str()) == -1) {
5151
PLOG(ERROR) << "Unable to create symlink " << symlink_path
5252
<< " pointing at " << log_path;

payload_consumer/delta_performer_integration_test.cc

+8
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,11 @@ static void GenerateDeltaFile(bool full_kernel,
464464

465465
EXPECT_TRUE(base::CopyFile(mnt_path.Append("regular-small"),
466466
mnt_path.Append("regular-small2")));
467+
#if BASE_VER < 800000
467468
EXPECT_TRUE(base::DeleteFile(mnt_path.Append("regular-small"), false));
469+
#else
470+
EXPECT_TRUE(base::DeleteFile(mnt_path.Append("regular-small")));
471+
#endif
468472
EXPECT_TRUE(base::Move(mnt_path.Append("regular-small2"),
469473
mnt_path.Append("regular-small")));
470474
EXPECT_TRUE(
@@ -491,7 +495,11 @@ static void GenerateDeltaFile(bool full_kernel,
491495
EXPECT_TRUE(base::Move(mnt_path.Append("tmp"),
492496
mnt_path.Append("link-hard-regular-16k")));
493497

498+
#if BASE_VER < 800000
494499
EXPECT_TRUE(base::DeleteFile(mnt_path.Append("link-short_symlink"), false));
500+
#else
501+
EXPECT_TRUE(base::DeleteFile(mnt_path.Append("link-short_symlink")));
502+
#endif
495503
EXPECT_TRUE(test_utils::WriteFileString(
496504
mnt_path.Append("link-short_symlink").value(), "foobar"));
497505

payload_consumer/postinstall_runner_action.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void PostinstallRunnerAction::ReportProgress(double frac) {
284284
void PostinstallRunnerAction::Cleanup() {
285285
utils::UnmountFilesystem(fs_mount_dir_);
286286
#ifndef __ANDROID__
287-
if (!base::DeleteFile(base::FilePath(fs_mount_dir_), false)) {
287+
if (!base::DeleteFile(base::FilePath(fs_mount_dir_))) {
288288
PLOG(WARNING) << "Not removing temporary mountpoint " << fs_mount_dir_;
289289
}
290290
#endif // !__ANDROID__

0 commit comments

Comments
 (0)