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.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Merge remote-tracking branch 'origin/main' into fix/empty-files-and-shortcuts
KnifeLemonc912eb479312
diff --cc src/Filee.App/Services/DraggedFiles.csindex 00000000,0a9b47c3..e5fca059mode 000000,100644..100644--- a/src/Filee.App/Services/DraggedFiles.cs+++ b/src/Filee.App/Services/DraggedFiles.cs@@@ -1,0 -1,45 +1,49 @@@+ // The local files in a drag. Avalonia reads file URLs (what Explorer, Finder and Linux file managers offer); on macOS+ // some other file managers offer the older NSFilenamesPboardType array of paths instead (QSpace Pro, issue #160),+ // which Avalonia passes through as a platform format of its own.++ using Avalonia.Input;+ using Avalonia.Platform.Storage;+ using Filee.Core.Platform;+ using Filee.Platform.MacOS;++ namespace Filee.App.Services;++ internal static class DraggedFiles+ {+ /// <summary>Whether the drag offers files in a form Filee reads (they may still turn out to be folders).</summary>+ public static bool Offered(IDataTransfer data) =>+ data.Contains(DataFormat.File) || data.Items.Any(item => item.Formats.Any(IsFilenames));+- /// <summary>Local file paths in the drag (folders and virtual items are ignored).</summary>- public static IReadOnlyList<string> Local(IDataTransfer data) => Local(data, File.Exists);-- internal static IReadOnlyList<string> Local(IDataTransfer data, Func<string, bool> fileExists)++ /// <summary>++ /// Local file paths in the drag (folders and virtual items are ignored). A shortcut counts as the file it points++ /// to; one to a folder is ignored like the folder.++ /// </summary>++ public static IReadOnlyList<string> Local(IDataTransfer data) =>++ Local(data, File.Exists, AppHost.Get<IPlatformServices>().ResolveShortcuts);++++ internal static IReadOnlyList<string> Local(IDataTransfer data, Func<string, bool> fileExists,++ Func<IReadOnlyList<string>, IReadOnlyList<string>>? resolveShortcuts = null)+ {- var files = (data.TryGetFiles() ?? [])- .Select(item => item.TryGetLocalPath())- .OfType<string>()- .Where(fileExists)- .ToList();- return files.Count > 0 ? files : Filenames(data).Where(fileExists).Distinct(FileSystemPaths.Comparer).ToList();++ IReadOnlyList<string> Usable(IReadOnlyList<string> paths) =>++ (resolveShortcuts?.Invoke(paths) ?? paths).Where(fileExists).Distinct(FileSystemPaths.Comparer).ToList();++++ var files = Usable((data.TryGetFiles() ?? []).Select(item => item.TryGetLocalPath()).OfType<string>().ToList());++ return files.Count > 0 ? files : Usable(Filenames(data).ToList());+ }++ /// <summary>The formats a drag offers, for the log when Filee finds no files in it.</summary>+ public static string Describe(IDataTransfer data) =>+ data.Formats.Count == 0 ? "nothing" : string.Join(", ", data.Formats.Select(format => format.Identifier).Distinct());++ private static IEnumerable<string> Filenames(IDataTransfer data) =>+ data.Items.SelectMany(item => item.Formats.Where(IsFilenames).SelectMany(format => item.TryGetRaw(format) switch+ {+ byte[] bytes => PasteboardPaths.FromPropertyList(bytes),+ string text => PasteboardPaths.FromPropertyList(text),+ _ => [],+ }));++ private static bool IsFilenames(DataFormat format) =>+ format.Kind == DataFormatKind.Platform && PasteboardPaths.IsFilenamesType(format.Identifier);+ }diff --cc src/Filee.App/Services/RadialController.csindex 4bf2622d,1344eb2e..cc7dcb9c--- a/src/Filee.App/Services/RadialController.cs+++ b/src/Filee.App/Services/RadialController.cs@@@ -90,10 -93,12 +93,14 @@@ public sealed class RadialController}, EmptyDragLimit);}- /// <summary>Opens the donut for known files (click mode). Shortcuts among them stand for the files they point to.</summary>- public void ShowForFiles(int x, int y, IReadOnlyList<string> files)+ /// <summary>- /// Opens the donut for known files (click mode). <paramref name="forAnotherProcess"/>: the files came from a later- /// launch or the Services menu, so on macOS the donut may lose focus once while Filee becomes the active app.++ /// Opens the donut for known files (click mode). Shortcuts among them stand for the files they point to.++ /// <paramref name="forAnotherProcess"/>: the files came from a later launch or the Services menu, so on macOS the++ /// donut may lose focus once while Filee becomes the active app.+ /// </summary>+ public void ShowForFiles(int x, int y, IReadOnlyList<string> files, bool forAnotherProcess = false){+ files = platform.ResolveShortcuts(files);if (files.Count == 0)return;ReleaseProgressToToast();diff --cc src/Filee.App/Views/RadialWindow.axaml.csindex 0cb748e2,45da984c..64dcdb23--- a/src/Filee.App/Views/RadialWindow.axaml.cs+++ b/src/Filee.App/Views/RadialWindow.axaml.cs@@@ -3,10 -3,8 +3,9 @@@using Avalonia;using Avalonia.Controls;using Avalonia.Input;- using Avalonia.Platform.Storage;using Filee.App.Controls;using Filee.App.Services;+using Filee.Core.Platform;namespace Filee.App.Views;