public void Delete(bool recursive)
        {
            if (recursive)
            {
                foreach (UnixFileSystemInfo e in GetFileSystemEntries())
                {
                    UnixDirectoryInfo d = e as UnixDirectoryInfo;
                    if (d != null)
                    {
                        d.Delete(true);
                    }
                    else
                    {
                        e.Delete();
                    }
                }
            }
            int r = Native.Syscall.rmdir(FullPath);

            UnixMarshal.ThrowExceptionForLastErrorIf(r);
            base.Refresh();
        }
 public void Delete(bool recursive)
 {
     if (recursive)
     {
         UnixFileSystemInfo[] fileSystemEntries = this.GetFileSystemEntries();
         for (int i = 0; i < (int)fileSystemEntries.Length; i++)
         {
             UnixFileSystemInfo unixFileSystemInfo = fileSystemEntries[i];
             UnixDirectoryInfo  unixDirectoryInfo  = unixFileSystemInfo as UnixDirectoryInfo;
             if (unixDirectoryInfo == null)
             {
                 unixFileSystemInfo.Delete();
             }
             else
             {
                 unixDirectoryInfo.Delete(true);
             }
         }
     }
     UnixMarshal.ThrowExceptionForLastErrorIf(Syscall.rmdir(base.FullPath));
     base.Refresh();
 }
Esempio n. 3
0
 public void Delete(string directory, bool recursive)
 {
     UnixDirectoryInfo unix_dir = new UnixDirectoryInfo (directory);
     unix_dir.Delete (recursive);
 }