src/developer/forensics/crash_reports/store.cc
// Recursively delete empty directories under |root|, including |root| if it is empty or becomes
// empty.
Recursively delete empty directories under |root|, including |root| if it is empty or becomes
empty.
Recursively delete empty directories under |root| including |root| if it is empty or becomes empty .
void RemoveEmptyDirectories(const std::string& root) {
  std::vector<std::string> contents = GetDirectoryContents(root);
  if (contents.empty()) {
    DeletePath(root);
    return;
  }
  for (const auto& content : contents) {
    const std::string path = files::JoinPath(root, content);
    if (files::IsDirectory(path)) {
      RemoveEmptyDirectories(path);
    }
  }
  if (GetDirectoryContents(root).empty()) {
    DeletePath(root);
  }
}
void RemoveEmptyDirectories ( const std :: string & root ) { std :: vector < std :: string > contents = GetDirectoryContents ( root ) ; if ( contents . empty ( ) ) { DeletePath ( root ) ; return ; } for ( const auto & content : contents ) { const std :: string path = files :: JoinPath ( root , content ) ; if ( files :: IsDirectory ( path ) ) { RemoveEmptyDirectories ( path ) ; } } if ( GetDirectoryContents ( root ) . empty ( ) ) { DeletePath ( root ) ; } }
Recursively delete empty directories under |root|, including |root| if it is empty or becomes
empty.
Recursively delete empty directories under |root| including |root| if it is empty or becomes empty .