From 56f9cd914c9b0c8162d9dae0b1c59ced1ea79769 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 3 Feb 2026 12:10:56 +0000 Subject: [PATCH] [exFAT] Implement GetAttributes. --- Aaru.Filesystems/exFAT/File.cs | 31 +++++++++++++++++++++++++ Aaru.Filesystems/exFAT/Unimplemented.cs | 4 ---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/Aaru.Filesystems/exFAT/File.cs b/Aaru.Filesystems/exFAT/File.cs index 96ca6b705..60cf348c9 100644 --- a/Aaru.Filesystems/exFAT/File.cs +++ b/Aaru.Filesystems/exFAT/File.cs @@ -38,6 +38,37 @@ namespace Aaru.Filesystems; /// public sealed partial class exFAT { + /// + public ErrorNumber GetAttributes(string path, out CommonTypes.Structs.FileAttributes attributes) + { + attributes = new CommonTypes.Structs.FileAttributes(); + + if(!_mounted) return ErrorNumber.AccessDenied; + + ErrorNumber errno = GetFileEntry(path, out CompleteDirectoryEntry entry); + + if(errno != ErrorNumber.NoError) return errno; + + if(entry.IsDirectory) + attributes |= CommonTypes.Structs.FileAttributes.Directory; + else + attributes |= CommonTypes.Structs.FileAttributes.File; + + if(entry.FileEntry.FileAttributes.HasFlag(FileAttributes.ReadOnly)) + attributes |= CommonTypes.Structs.FileAttributes.ReadOnly; + + if(entry.FileEntry.FileAttributes.HasFlag(FileAttributes.Hidden)) + attributes |= CommonTypes.Structs.FileAttributes.Hidden; + + if(entry.FileEntry.FileAttributes.HasFlag(FileAttributes.System)) + attributes |= CommonTypes.Structs.FileAttributes.System; + + if(entry.FileEntry.FileAttributes.HasFlag(FileAttributes.Archive)) + attributes |= CommonTypes.Structs.FileAttributes.Archive; + + return ErrorNumber.NoError; + } + /// public ErrorNumber Stat(string path, out FileEntryInfo stat) { diff --git a/Aaru.Filesystems/exFAT/Unimplemented.cs b/Aaru.Filesystems/exFAT/Unimplemented.cs index bc0be0a77..e3aa71b8c 100644 --- a/Aaru.Filesystems/exFAT/Unimplemented.cs +++ b/Aaru.Filesystems/exFAT/Unimplemented.cs @@ -39,10 +39,6 @@ public sealed partial class exFAT /// public ErrorNumber Unmount() => throw new NotImplementedException(); - /// - public ErrorNumber GetAttributes(string path, out CommonTypes.Structs.FileAttributes attributes) => - throw new NotImplementedException(); - /// public ErrorNumber OpenFile(string path, out IFileNode node) => throw new NotImplementedException();