/// <summary> /// Called to delete a child from a directory. /// </summary> /// <param name="child">The IVfsNode interface of the child.</param> /// <param name="dentry">The DirectoryEntry of the child.</param> /// <remarks> /// This function deletes a child IVfsNode from a directory. If child is a directory, it will be empty /// before this call is executed. It is recommended to include a debug sanity check though. If the file /// system needs to know the name of the child to delete, it can retrieve it from <see cref="DirectoryEntry.Name"/>. /// </remarks> /// <exception cref="System.NotSupportedException">The object does not support removal this way. There's most likely an object specific API to remove this IVfsNode.</exception> public override void Delete(IVfsNode child, DirectoryEntry dentry) { FatFileSystem fs = this.FileSystem as FatFileSystem; uint targetCluster = (child as VfsDirectory).directoryCluster; FatFileLocation location = fs.FindEntry(new Find.ByCluster(targetCluster), this.directoryCluster); if (!location.Valid) { throw new System.ArgumentException(); //throw new IOException ("Unable to delete directory because it is not empty"); } fs.Delete(targetCluster, location.DirectorySector, location.DirectorySectorIndex); }