Ejemplo n.º 1
0
bool Directory::empty(const std::string& path)
{
  assert(!path.empty());
  Iterator::Ptr it = enumerate(path);
  while (it->moveNext())
    {
      if (it->name() != "." && it->name() != "..")
	return 0;
      continue;
    }
  return 1;
}
Ejemplo n.º 2
0
void Directory::eraseContent(const std::string& name)
{
  assert(!name.empty());
  Iterator::Ptr it = enumerate(name);
  while(it->moveNext())
    {
      if (it->name() == "." || it->name() == "..")
	continue;
      const std::string& path = it->fullPath();
      if (File::isDir(path))
	{
	  eraseContent(path);
	  remove(path);
	  continue;
	}
      File::unlink(path);
    }
}