private void Delete (string directory, GLib.File dir, bool recursive) { if (!dir.Exists) { Console.WriteLine ("{0} doesn't exist", directory); return; } if ((dir.QueryFileType (FileQueryInfoFlags.None, null) & FileType.Directory) == 0) { Console.WriteLine ("{0} isn't directory", directory); return; } // If native, use the System.IO recursive delete if (dir.IsNative && !DisableNativeOptimizations) { System.IO.Directory.Delete (directory, recursive); return; } if (recursive) { foreach (string child in GetFiles (dir, false)) { FileFactory.NewForUri (child).Delete (); } foreach (string child in GetDirectories (dir, false)) { Delete (child, GetDir (child, true), true); } } dir.Delete (); }
private void Delete (string directory, GLib.File dir, bool recursive) { if (!dir.Exists) { return; } if (dir.QueryFileType (FileQueryInfoFlags.NofollowSymlinks, null) != FileType.Directory) { return; } // If native, use the System.IO recursive delete if (dir.IsNative && !DisableNativeOptimizations) { System.IO.Directory.Delete (directory, recursive); return; } if (recursive) { foreach (string child in GetFiles (dir, false)) { FileFactory.NewForUri (child).Delete (); } foreach (string child in GetDirectories (dir, false)) { Delete (child, GetDir (child, true), true); } } dir.Delete (); }