blob: 67c2f16e4493a43c4d5a02bbf534524de0a87a4c [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/lib/util/file_system.h"
#include "absl/strings/str_cat.h"
namespace cobalt::util {
bool FileSystem::DeleteRecursive(const std::string &directory) {
auto children = ListFiles(directory).ConsumeValueOr({});
for (const auto &child : children) {
if (!DeleteRecursive(absl::StrCat(directory, "/", child))) {
return false;
}
}
return Delete(directory);
}
} // namespace cobalt::util