diff --git a/NAPS2.Lib/Pdf/SavePdfOperation.cs b/NAPS2.Lib/Pdf/SavePdfOperation.cs index db00bd7612..51a34cd148 100644 --- a/NAPS2.Lib/Pdf/SavePdfOperation.cs +++ b/NAPS2.Lib/Pdf/SavePdfOperation.cs @@ -114,7 +114,7 @@ public bool Start(string fileName, Placeholders placeholders, ICollection /// Creates the parent directory for the provided path if needed. /// @@ -15,6 +18,10 @@ public static void EnsureParentDirExists(string filePath) } } + // TODO: Can we detect this on Linux/Mac? + public static bool IsDiskFullException(IOException exception) => + exception.HResult is HR_ERROR_DISK_FULL or HR_ERROR_HANDLE_DISK_FULL; + public static bool IsFileInUse(string filePath, out Exception? exception) { if (File.Exists(filePath)) @@ -34,7 +41,7 @@ public static bool IsFileInUse(string filePath, out Exception? exception) exception = null; return false; } - + // https://learn.microsoft.com/en-us/dotnet/standard/io/how-to-copy-directories public static void CopyDirectory(string sourceDir, string destinationDir, bool recursive) {