public static void Delete(string path) { if (unix.IsUnix) { System.IO.File.Delete(path); return; } string fixPath = NameFix.AddLongPathPrefix(path); if (!Win32Native.DeleteFile(fixPath)) { int hr = Marshal.GetLastWin32Error(); if (hr != Win32Native.ERROR_FILE_NOT_FOUND) { throw new Exception(GetErrorCode(hr), new Exception("ERROR_DELETING_FILE. (" + path + ")")); } } }
public static void Delete(String path) { if (unix.IsUnix) { System.IO.File.Delete(path); return; } string fixPath = NameFix.AddLongPathPrefix(path); if (!Win32Native.DeleteFile(fixPath)) { int hr = Marshal.GetLastWin32Error(); if (hr != Win32Native.ERROR_FILE_NOT_FOUND) { throw new Exception("Error while deleting file :" + path); } } }