Ejemplo n.º 1
0
 bool fileexists(const Poco::Path & parent, std::string name)
 {
    drunner_assert(parent.isDirectory(),"fileexists: non-dir passed as parent dir");
    Poco::Path p(parent);
    p.setFileName(name);
    return fileexists(p);
 }
Ejemplo n.º 2
0
   // recusively delete the path given. we do this manually to set the permissions to writable,
   // so that windows doesn't cause permission denied errors.
   cResult deltree(Poco::Path s)
   {
      drunner_assert(s.isDirectory(), "deltree: asked to delete a file: "+s.toString());
      cResult rval = kRNoChange;

      try
      {
         Poco::DirectoryIterator end;
         for (Poco::DirectoryIterator it(s); it != end; ++it)
            if (it->isFile())
               rval += delfile(it->path());
            else
            {
               Poco::Path subdir(it->path());
               subdir.makeDirectory();
               rval += deltree(subdir);
            }

         Poco::File f(s);
         f.setWriteable(true);
         f.remove();
         logmsg(kLDEBUG, "Deleted " + f.path());
      }
      catch (const Poco::Exception & e) {
         return cError("Couldn't delete " + s.toString() + " - " + e.what());
      }
      return kRSuccess;
   }