Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Replace the original: mark the Recycle Bin and freedesktop Trash code by platform

cre8ive-marketingd8a56c0a2d38
diff --git a/src/Filee.Platform.Linux/FreedesktopTrash.cs b/src/Filee.Platform.Linux/FreedesktopTrash.cs
index 9182dfcb..08d61d61 100644
--- a/src/Filee.Platform.Linux/FreedesktopTrash.cs
+++ b/src/Filee.Platform.Linux/FreedesktopTrash.cs
@@ -4,11 +4,13 @@
// are left where they are.
using System.Globalization;
+using System.Runtime.Versioning;
using System.Text;
using Filee.Core.Platform;
namespace Filee.Platform.Linux;
+[UnsupportedOSPlatform("windows")]
internal static class FreedesktopTrash
{
/// <summary>The spec asks for Trash folders only their owner can open.</summary>
diff --git a/src/Filee.Platform.Windows/RecycleBin.cs b/src/Filee.Platform.Windows/RecycleBin.cs
index 8691eef4..c9bb9fcd 100644
--- a/src/Filee.Platform.Windows/RecycleBin.cs
+++ b/src/Filee.Platform.Windows/RecycleBin.cs
@@ -5,10 +5,12 @@
// the file then stays where it is. IFileOperation needs an STA thread.
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
using Filee.Core.Platform;
namespace Filee.Platform.Windows;
+[SupportedOSPlatform("windows")]
internal static class RecycleBin
{
private const uint FOF_SILENT = 0x4;
@@ -162,7 +164,8 @@ internal static class RecycleBin
[PreserveSig] int PreDeleteItem(uint flags, IShellItem item);
[PreserveSig] int PostDeleteItem(uint flags, IShellItem item, int result, IShellItem? created);
[PreserveSig] int PreNewItem(uint flags, IShellItem destination, [MarshalAs(UnmanagedType.LPWStr)] string? newName);
- [PreserveSig] int PostNewItem(uint flags, IShellItem destination, [MarshalAs(UnmanagedType.LPWStr)] string? newName,
+ [PreserveSig]
+ int PostNewItem(uint flags, IShellItem destination, [MarshalAs(UnmanagedType.LPWStr)] string? newName,
[MarshalAs(UnmanagedType.LPWStr)] string? template, uint attributes, int result, IShellItem? created);
[PreserveSig] int UpdateProgress(uint total, uint done);
[PreserveSig] int ResetTimer();
diff --git a/tests/Filee.Platform.Tests/TrashTests.cs b/tests/Filee.Platform.Tests/TrashTests.cs
index cc2af22d..d6deb56c 100644
--- a/tests/Filee.Platform.Tests/TrashTests.cs
+++ b/tests/Filee.Platform.Tests/TrashTests.cs
@@ -5,6 +5,9 @@ using Filee.Platform.Linux;
using Filee.Platform.MacOS;
using Filee.Platform.Windows;
+// Each test checks the OS it needs; the mount and missing-file checks are plain string and file work.
+#pragma warning disable CA1416
+
namespace Filee.Platform.Tests;
public sealed class TrashTests : IDisposable