public override void Delete() { if (LongPathFile.Exists(Path)) { LongPathFile.Delete(Path); } }
public void Delete(string filePath) { AssertAllowed(filePath); #if !MONO var mTx = CurrentTransaction(); if (mTx.HasValue) { ((IFileAdapter)mTx.Value).Delete(filePath); return; } #endif LongPathFile.Delete(filePath); }
/// <summary> /// Delete non empty directory tree /// </summary> private void DeleteDirectory(string target_dir) { string[] files = Directory.GetFiles(target_dir); string[] dirs = Directory.GetDirectories(target_dir); foreach (string file in files) { try { File.SetAttributes(file, FileAttributes.Normal); File.Delete(file); } catch (PathTooLongException) { LongPathFile.Delete(file); } } foreach (string dir in dirs) { // Only recurse into "normal" directories if ((File.GetAttributes(dir) & FileAttributes.ReparsePoint) == FileAttributes.ReparsePoint) { try { Directory.Delete(dir, false); } catch (PathTooLongException) { LongPathDirectory.Delete(dir); } } else { DeleteDirectory(dir); } } try { Directory.Delete(target_dir, false); } catch (PathTooLongException) { LongPathDirectory.Delete(target_dir); } }
public static void Delete(string path) { if (path.Length < MAX_PATH) { if (File.Exists(path)) { System.IO.File.Delete(path); } } else { if (LongPathFile.Exists(path)) { LongPathFile.Delete(path); } } }
private void DeleteAllFolder(String parentDirectory) { if (parentDirectory == null) { return; } foreach (String file in LongPathDirectory.EnumerateFiles(parentDirectory)) { LongPathFile.Delete(file); } foreach (String info in LongPathDirectory.EnumerateDirectories(parentDirectory)) { this.DeleteAllFolder(info); } Microsoft.Experimental.IO.LongPathDirectory.Delete(parentDirectory); }
private void OnDeleteButtonClick(object sender, EventArgs e) { string selectedPath = (string)fileSystemEntriesListBox.SelectedItem; try { if (LongPathDirectory.Exists(selectedPath)) { LongPathDirectory.Delete(selectedPath); } else { LongPathFile.Delete(selectedPath); } } catch (IOException ex) { ShowError(ex); } catch (UnauthorizedAccessException ex) { ShowError(ex); } RefreshFileList(); }
/// <summary> /// Permanently deletes a file. /// </summary> /// <exception cref="IOException"> /// The target file is open or memory-mapped on a computer running Microsoft Windows NT. /// <para>-or-</para> /// There is an open handle on the file, and the operating system is Windows XP or earlier. /// </exception> /// <exception cref="SecurityException">The caller does not have the required permission.</exception> /// <exception cref="UnauthorizedAccessException">The path is a directory.</exception> public override void Delete() { LongPathFile.Delete(this.NormalizedPath); this.Refresh(); }
public virtual void Delete() { LongPathFile.Delete(filePath); }
public override void DeleteFile(string filePath) { LongPathFile.Delete(filePath); }