Logo Search packages:      
Sourcecode: djvulibre version File versions

int GURL::cleardir ( const int  timeout = 0  )  const

Recursively erases contents of directory. The directory itself will not be removed.

Definition at line 1628 of file GURL.cpp.

References cleardir(), deletefile(), is_dir(), listdir(), and GOS::sleep().

Referenced by cleardir().

{
  int retval=(-1);
  if(is_dir())
  {
    GList<GURL> dirlist=listdir();
    retval=0;
    for(GPosition pos=dirlist;pos&&!retval;++pos)
    {
      const GURL &Entry=dirlist[pos];
      if(Entry.is_dir())
      {
        if((retval=Entry.cleardir(timeout)) < 0)
        {
          break;
        }
      }
      if(((retval=Entry.deletefile())<0) && (timeout>0))
      {
        GOS::sleep(timeout);
        retval=Entry.deletefile();
      }
    }
  }
  return retval;
}


Generated by  Doxygen 1.6.0   Back to index