mirror of
https://github.com/aaru-dps/Aaru.git
synced 2026-04-05 21:44:05 +00:00
Remove GetAttributes interface method.
This commit is contained in:
@@ -76,20 +76,6 @@ public sealed partial class Amg
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(int entryNumber, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
if(!Opened) return ErrorNumber.NotOpened;
|
||||
|
||||
if(entryNumber < 0 || entryNumber >= _files.Count) return ErrorNumber.OutOfRange;
|
||||
|
||||
attributes = _files[entryNumber].Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(int entryNumber, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -83,20 +83,6 @@ public sealed partial class Arc
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(int entryNumber, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
if(!Opened) return ErrorNumber.NotOpened;
|
||||
|
||||
if(entryNumber < 0 || entryNumber >= _entries.Count) return ErrorNumber.OutOfRange;
|
||||
|
||||
attributes = _entries[entryNumber].Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(int entryNumber, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -81,20 +81,6 @@ public sealed partial class Ha
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(int entryNumber, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
if(!Opened) return ErrorNumber.NotOpened;
|
||||
|
||||
if(entryNumber < 0 || entryNumber >= _entries.Count) return ErrorNumber.OutOfRange;
|
||||
|
||||
attributes = _entries[entryNumber].Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(int entryNumber, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@ using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Filters;
|
||||
using FileAttributes = System.IO.FileAttributes;
|
||||
|
||||
namespace Aaru.Archives;
|
||||
|
||||
@@ -77,23 +76,6 @@ public sealed partial class Stfs
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(int entryNumber, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
if(!Opened) return ErrorNumber.NotOpened;
|
||||
|
||||
if(entryNumber < 0 || entryNumber >= _entries.Length) return ErrorNumber.OutOfRange;
|
||||
|
||||
if(_entries[entryNumber].IsDirectory)
|
||||
attributes |= FileAttributes.Directory;
|
||||
else
|
||||
attributes |= FileAttributes.Normal;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(int entryNumber, out FileEntryInfo stat)
|
||||
{
|
||||
@@ -107,7 +89,7 @@ public sealed partial class Stfs
|
||||
|
||||
stat = new FileEntryInfo
|
||||
{
|
||||
Attributes = CommonTypes.Structs.FileAttributes.None,
|
||||
Attributes = FileAttributes.None,
|
||||
Blocks = entry.FileSize / 4096,
|
||||
BlockSize = 4096,
|
||||
Length = entry.FileSize,
|
||||
@@ -120,9 +102,9 @@ public sealed partial class Stfs
|
||||
if(entry.FileSize % 4096 != 0) stat.Blocks++;
|
||||
|
||||
if(entry.IsDirectory)
|
||||
stat.Attributes |= CommonTypes.Structs.FileAttributes.Directory;
|
||||
stat.Attributes |= FileAttributes.Directory;
|
||||
else
|
||||
stat.Attributes |= CommonTypes.Structs.FileAttributes.File;
|
||||
stat.Attributes |= FileAttributes.File;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Filters;
|
||||
using Aaru.Helpers.IO;
|
||||
using FileAttributes = System.IO.FileAttributes;
|
||||
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
|
||||
|
||||
namespace Aaru.Archives;
|
||||
|
||||
@@ -108,20 +108,6 @@ public sealed partial class Symbian
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(int entryNumber, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
if(!Opened) return ErrorNumber.NotOpened;
|
||||
|
||||
if(entryNumber < 0 || entryNumber >= _files.Count) return ErrorNumber.OutOfRange;
|
||||
|
||||
attributes = FileAttributes.Normal;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(int entryNumber, out FileEntryInfo stat)
|
||||
{
|
||||
@@ -134,7 +120,7 @@ public sealed partial class Symbian
|
||||
stat = new FileEntryInfo
|
||||
{
|
||||
Length = _compressed ? _files[entryNumber].originalLength : _files[entryNumber].length,
|
||||
Attributes = CommonTypes.Structs.FileAttributes.File,
|
||||
Attributes = FileAttributes.File,
|
||||
Inode = (ulong)entryNumber
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.Compression;
|
||||
using Aaru.Filters;
|
||||
using Aaru.Helpers;
|
||||
using Aaru.Helpers.IO;
|
||||
using FileAttributes = System.IO.FileAttributes;
|
||||
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
|
||||
|
||||
namespace Aaru.Archives;
|
||||
|
||||
@@ -104,19 +104,6 @@ public sealed partial class Zoo
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(int entryNumber, out FileAttributes attributes)
|
||||
{
|
||||
// DOS version of ZOO ignores the attributes, so we just say it's a file
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
if(!Opened) return ErrorNumber.NotOpened;
|
||||
|
||||
if(entryNumber < 0 || entryNumber >= _files.Count) return ErrorNumber.OutOfRange;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetEntryNumber(string fileName, bool caseInsensitiveMatch, out int entryNumber)
|
||||
{
|
||||
@@ -155,7 +142,7 @@ public sealed partial class Zoo
|
||||
stat = new FileEntryInfo
|
||||
{
|
||||
Length = entry.org_size,
|
||||
Attributes = CommonTypes.Structs.FileAttributes.File,
|
||||
Attributes = FileAttributes.File,
|
||||
Blocks = entry.org_size / 512,
|
||||
BlockSize = 512,
|
||||
LastWriteTime = DateHandlers.DosToDateTime(entry.date, entry.time),
|
||||
|
||||
@@ -38,7 +38,6 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using FileAttributes = System.IO.FileAttributes;
|
||||
|
||||
namespace Aaru.CommonTypes.Interfaces;
|
||||
|
||||
@@ -160,13 +159,6 @@ public interface IArchive
|
||||
/// <seealso cref="GetCompressedSize" />
|
||||
ErrorNumber GetUncompressedSize(int entryNumber, out long length);
|
||||
|
||||
/// <summary>Gets the attributes of a file or directory.</summary>
|
||||
/// <param name="entryNumber">The entry in the archive for which to retrieve the attributes.</param>
|
||||
/// <param name="attributes">File attributes, or zero if the archive does not support attributes.</param>
|
||||
/// <returns>Error number.</returns>
|
||||
/// <seealso cref="Stat" />
|
||||
ErrorNumber GetAttributes(int entryNumber, out FileAttributes attributes);
|
||||
|
||||
/// <summary>Lists all extended attributes, alternate data streams and forks of the given file.</summary>
|
||||
/// <param name="entryNumber">The entry in the archive for which to retrieve the list of attributes.</param>
|
||||
/// <param name="xattrs">List of extended attributes, alternate data streams and forks.</param>
|
||||
@@ -185,7 +177,6 @@ public interface IArchive
|
||||
/// <param name="entryNumber">The entry int he archive for which to get the information</param>
|
||||
/// <param name="stat">The available information about the entry in the archive</param>
|
||||
/// <returns>Error number.</returns>
|
||||
/// <seealso cref="GetAttributes" />
|
||||
/// <seealso cref="GetFilename" />
|
||||
ErrorNumber Stat(int entryNumber, out FileEntryInfo stat);
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ using System.Text;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
|
||||
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
|
||||
|
||||
namespace Aaru.CommonTypes.Interfaces;
|
||||
@@ -81,12 +80,6 @@ public interface IReadOnlyFilesystem : IFilesystem
|
||||
/// <summary>Frees all internal structures created by <see cref="Mount" /></summary>
|
||||
ErrorNumber Unmount();
|
||||
|
||||
/// <summary>Gets the attributes of a file or directory</summary>
|
||||
/// <returns>Error number.</returns>
|
||||
/// <param name="path">File path.</param>
|
||||
/// <param name="attributes">File attributes.</param>
|
||||
ErrorNumber GetAttributes(string path, out FileAttributes attributes);
|
||||
|
||||
/// <summary>Lists all extended attributes, alternate data streams and forks of the given file.</summary>
|
||||
/// <returns>Error number.</returns>
|
||||
/// <param name="path">Path.</param>
|
||||
|
||||
@@ -276,25 +276,6 @@ public sealed partial class AmigaDOSPlugin
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "GetAttributes: path='{0}'", path);
|
||||
|
||||
// Use Stat to get file information
|
||||
ErrorNumber errno = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -137,8 +137,7 @@ public sealed partial class AppleDOS
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
|
||||
|
||||
@@ -206,24 +206,6 @@ public sealed partial class AppleHFS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = 0;
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
// Get file/directory info using Stat
|
||||
ErrorNumber statErr = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(statErr != ErrorNumber.NoError) return statErr;
|
||||
|
||||
// Set attributes based on file type
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -427,24 +427,6 @@ public sealed partial class AppleHFSPlus
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = 0;
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
// Get file/directory info using Stat
|
||||
ErrorNumber statErr = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(statErr != ErrorNumber.NoError) return statErr;
|
||||
|
||||
// Set attributes based on stat information
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -146,56 +146,6 @@ public sealed partial class AppleMFS
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
path = pathElements[0];
|
||||
|
||||
if(!_filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId)) return ErrorNumber.NoSuchFile;
|
||||
|
||||
if(!_idToEntry.TryGetValue(fileId, out FileEntry entry)) return ErrorNumber.NoSuchFile;
|
||||
|
||||
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsAlias)) attributes |= FileAttributes.Alias;
|
||||
|
||||
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasBundle)) attributes |= FileAttributes.Bundle;
|
||||
|
||||
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasBeenInited))
|
||||
attributes |= FileAttributes.HasBeenInited;
|
||||
|
||||
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasCustomIcon))
|
||||
attributes |= FileAttributes.HasCustomIcon;
|
||||
|
||||
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasNoINITs)) attributes |= FileAttributes.HasNoINITs;
|
||||
|
||||
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsInvisible)) attributes |= FileAttributes.Hidden;
|
||||
|
||||
if(entry.flFlags.HasFlag(FileFlags.Locked)) attributes |= FileAttributes.Immutable;
|
||||
|
||||
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsOnDesk)) attributes |= FileAttributes.IsOnDesk;
|
||||
|
||||
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsShared)) attributes |= FileAttributes.Shared;
|
||||
|
||||
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsStationery))
|
||||
attributes |= FileAttributes.Stationery;
|
||||
|
||||
if(!attributes.HasFlag(FileAttributes.Alias) &&
|
||||
!attributes.HasFlag(FileAttributes.Bundle) &&
|
||||
!attributes.HasFlag(FileAttributes.Stationery))
|
||||
attributes |= FileAttributes.File;
|
||||
|
||||
attributes |= FileAttributes.BlockUnits;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber OpenFile(string path, out IFileNode node)
|
||||
{
|
||||
@@ -338,7 +288,71 @@ public sealed partial class AppleMFS
|
||||
|
||||
if(!_idToEntry.TryGetValue(fileId, out FileEntry entry)) return ErrorNumber.NoSuchFile;
|
||||
|
||||
ErrorNumber error = GetAttributes(path, out FileAttributes attr);
|
||||
string path1 = path;
|
||||
ErrorNumber error;
|
||||
var attr = new FileAttributes();
|
||||
|
||||
if(!_mounted)
|
||||
error = ErrorNumber.AccessDenied;
|
||||
else
|
||||
{
|
||||
string[] pathElements1 = path1.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements1.Length != 1)
|
||||
error = ErrorNumber.NotSupported;
|
||||
else
|
||||
{
|
||||
path1 = pathElements1[0];
|
||||
|
||||
if(!_filenameToId.TryGetValue(path1.ToLowerInvariant(), out uint fileId1))
|
||||
error = ErrorNumber.NoSuchFile;
|
||||
else
|
||||
{
|
||||
if(!_idToEntry.TryGetValue(fileId1, out FileEntry entry1))
|
||||
error = ErrorNumber.NoSuchFile;
|
||||
else
|
||||
{
|
||||
if(entry1.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsAlias))
|
||||
attr |= FileAttributes.Alias;
|
||||
|
||||
if(entry1.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasBundle))
|
||||
attr |= FileAttributes.Bundle;
|
||||
|
||||
if(entry1.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasBeenInited))
|
||||
attr |= FileAttributes.HasBeenInited;
|
||||
|
||||
if(entry1.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasCustomIcon))
|
||||
attr |= FileAttributes.HasCustomIcon;
|
||||
|
||||
if(entry1.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasNoINITs))
|
||||
attr |= FileAttributes.HasNoINITs;
|
||||
|
||||
if(entry1.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsInvisible))
|
||||
attr |= FileAttributes.Hidden;
|
||||
|
||||
if(entry1.flFlags.HasFlag(FileFlags.Locked)) attr |= FileAttributes.Immutable;
|
||||
|
||||
if(entry1.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsOnDesk))
|
||||
attr |= FileAttributes.IsOnDesk;
|
||||
|
||||
if(entry1.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsShared))
|
||||
attr |= FileAttributes.Shared;
|
||||
|
||||
if(entry1.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsStationery))
|
||||
attr |= FileAttributes.Stationery;
|
||||
|
||||
if(!attr.HasFlag(FileAttributes.Alias) &&
|
||||
!attr.HasFlag(FileAttributes.Bundle) &&
|
||||
!attr.HasFlag(FileAttributes.Stationery))
|
||||
attr |= FileAttributes.File;
|
||||
|
||||
attr |= FileAttributes.BlockUnits;
|
||||
|
||||
error = ErrorNumber.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(error != ErrorNumber.NoError) return error;
|
||||
|
||||
|
||||
@@ -233,33 +233,6 @@ public sealed partial class AtheOS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.File;
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "GetAttributes: path='{0}'", path);
|
||||
|
||||
// Use Stat to get the file information
|
||||
ErrorNumber statError = Stat(path, out FileEntryInfo fileInfo);
|
||||
|
||||
if(statError != ErrorNumber.NoError)
|
||||
{
|
||||
AaruLogging.Debug(MODULE_NAME, "Error getting file stat: {0}", statError);
|
||||
|
||||
return statError;
|
||||
}
|
||||
|
||||
// Copy the attributes from the stat result
|
||||
attributes = fileInfo.Attributes;
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "GetAttributes successful: path='{0}', attributes=0x{1:X}", path, attributes);
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -115,41 +115,6 @@ public sealed partial class BeFS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <summary>Gets the file attributes for a given path</summary>
|
||||
/// <remarks>
|
||||
/// Determines the file attributes (directory, file, symlink, etc.) based on the i-node
|
||||
/// mode field. Uses Unix-style file type bits from the mode field.
|
||||
/// </remarks>
|
||||
/// <param name="path">Path to the file or directory</param>
|
||||
/// <param name="attributes">Output file attributes</param>
|
||||
/// <returns>Error code indicating success or failure</returns>
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.File;
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "GetAttributes: path='{0}'", path);
|
||||
|
||||
// Use Stat to get the file information
|
||||
ErrorNumber statError = Stat(path, out FileEntryInfo fileInfo);
|
||||
|
||||
if(statError != ErrorNumber.NoError)
|
||||
{
|
||||
AaruLogging.Debug(MODULE_NAME, "Error getting file stat: {0}", statError);
|
||||
|
||||
return statError;
|
||||
}
|
||||
|
||||
// Copy the attributes from the stat result
|
||||
attributes = fileInfo.Attributes;
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "GetAttributes successful: path='{0}', attributes=0x{1:X}", path, attributes);
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <summary>Gets file metadata (stat) for a given path</summary>
|
||||
/// <remarks>
|
||||
/// Locates the file/directory at the specified path, reads its i-node,
|
||||
|
||||
@@ -183,38 +183,6 @@ public sealed partial class BOFS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = 0;
|
||||
|
||||
if(string.IsNullOrEmpty(path) || path == "/")
|
||||
{
|
||||
// Root directory
|
||||
attributes = FileAttributes.Directory;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
// Use helper to lookup the entry
|
||||
ErrorNumber lookupErr = LookupEntry(path, out FileEntry entry);
|
||||
|
||||
if(lookupErr != ErrorNumber.NoError) return ErrorNumber.NoSuchFile;
|
||||
|
||||
// Set basic attributes based on FileType
|
||||
if(entry.FileType == DIR_TYPE)
|
||||
attributes |= FileAttributes.Directory;
|
||||
else
|
||||
attributes |= FileAttributes.File;
|
||||
|
||||
// Set read-only if no write permission for owner
|
||||
// Mode format: S_IFREG/S_IFDIR | permissions
|
||||
// Check owner write bit (0x80 = 0o200)
|
||||
if((entry.Mode & 0x80) == 0) attributes |= FileAttributes.ReadOnly;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,6 @@ using System;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
|
||||
@@ -40,26 +39,6 @@ public sealed partial class CBM
|
||||
{
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
string filename = pathElements[0].ToUpperInvariant();
|
||||
|
||||
if(!_cache.TryGetValue(filename, out CachedFile file)) return ErrorNumber.NoSuchFile;
|
||||
|
||||
attributes = file.attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -39,34 +39,6 @@ public sealed partial class CPM
|
||||
{
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
if(string.IsNullOrEmpty(pathElements[0]) ||
|
||||
string.Equals(pathElements[0], "/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
attributes = FileAttributes.Directory;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(!_statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out FileEntryInfo fInfo))
|
||||
return ErrorNumber.NoSuchFile;
|
||||
|
||||
attributes = fInfo.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber OpenFile(string path, out IFileNode node)
|
||||
{
|
||||
|
||||
@@ -155,22 +155,6 @@ public sealed partial class FAT
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
ErrorNumber err = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(err != ErrorNumber.NoError) return err;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber OpenFile(string path, out IFileNode node)
|
||||
{
|
||||
|
||||
@@ -110,22 +110,6 @@ public sealed partial class XboxFatPlugin
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
ErrorNumber err = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(err != ErrorNumber.NoError) return err;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber OpenFile(string path, out IFileNode node)
|
||||
{
|
||||
|
||||
@@ -215,22 +215,6 @@ public sealed partial class ISO9660
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
ErrorNumber err = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(err != ErrorNumber.NoError) return err;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber OpenFile(string path, out IFileNode node)
|
||||
{
|
||||
|
||||
@@ -105,8 +105,9 @@ public sealed partial class LisaFS
|
||||
if(!_mounted || !_debug) return ErrorNumber.AccessDenied;
|
||||
|
||||
if(fileId is > 4 or <= 0)
|
||||
if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
{
|
||||
if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) return ErrorNumber.InvalidArgument;
|
||||
}
|
||||
|
||||
if(_systemFileCache.TryGetValue(fileId, out buf) && !tags) return ErrorNumber.NoError;
|
||||
|
||||
@@ -329,8 +330,9 @@ public sealed partial class LisaFS
|
||||
if(!tags)
|
||||
{
|
||||
if(_fileSizeCache.TryGetValue(fileId, out int realSize))
|
||||
if(realSize > temp.Length)
|
||||
AaruLogging.Error(Localization.File_0_gets_truncated, fileId);
|
||||
{
|
||||
if(realSize > temp.Length) AaruLogging.Error(Localization.File_0_gets_truncated, fileId);
|
||||
}
|
||||
|
||||
buf = temp;
|
||||
|
||||
@@ -439,22 +441,6 @@ public sealed partial class LisaFS
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
|
||||
ErrorNumber error = LookupFileId(path, out short fileId, out bool isDir);
|
||||
|
||||
if(error != ErrorNumber.NoError) return error;
|
||||
|
||||
if(!isDir) return GetAttributes(fileId, out attributes);
|
||||
|
||||
attributes = FileAttributes.Directory;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber OpenFile(string path, out IFileNode node)
|
||||
{
|
||||
|
||||
@@ -134,7 +134,7 @@ public sealed partial class MicroDOS
|
||||
var offsetInBlock = (int)(currentOffset % BLOCK_SIZE);
|
||||
|
||||
// Physical block = starting block + logical block number
|
||||
uint physicalBlock = (uint)(fileNode.Entry.blockNo + blockNum);
|
||||
var physicalBlock = fileNode.Entry.blockNo + blockNum;
|
||||
|
||||
// Read the block
|
||||
ErrorNumber errno = _imagePlugin.ReadSector(_partition.Start + physicalBlock,
|
||||
@@ -152,11 +152,9 @@ public sealed partial class MicroDOS
|
||||
// Copy data from block to buffer
|
||||
long bytesToCopy = Math.Min(BLOCK_SIZE - offsetInBlock, toRead - bytesRead);
|
||||
|
||||
if(offsetInBlock + bytesToCopy > blockData.Length)
|
||||
bytesToCopy = blockData.Length - offsetInBlock;
|
||||
if(offsetInBlock + bytesToCopy > blockData.Length) bytesToCopy = blockData.Length - offsetInBlock;
|
||||
|
||||
if(bytesToCopy <= 0)
|
||||
break;
|
||||
if(bytesToCopy <= 0) break;
|
||||
|
||||
Array.Copy(blockData, offsetInBlock, buffer, bytesRead, bytesToCopy);
|
||||
|
||||
@@ -172,20 +170,6 @@ public sealed partial class MicroDOS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
ErrorNumber errno = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -80,22 +80,6 @@ public sealed partial class OperaFS
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
ErrorNumber err = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(err != ErrorNumber.NoError) return err;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber OpenFile(string path, out IFileNode node)
|
||||
{
|
||||
|
||||
@@ -253,25 +253,6 @@ public sealed partial class PFS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "GetAttributes: path='{0}'", path);
|
||||
|
||||
// Use Stat to get file information
|
||||
ErrorNumber errno = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -213,41 +213,6 @@ public sealed partial class ProDOSPlugin
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
// Get the entry for this path
|
||||
ErrorNumber errno = GetEntryForPath(path, out CachedEntry entry);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
// Directory
|
||||
if(entry.IsDirectory)
|
||||
{
|
||||
attributes = FileAttributes.Directory;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
// File attributes
|
||||
attributes = FileAttributes.File;
|
||||
|
||||
// ProDOS access flags
|
||||
if((entry.Access & READ_ATTRIBUTE) == 0) attributes |= FileAttributes.Hidden;
|
||||
|
||||
if((entry.Access & WRITE_ATTRIBUTE) == 0) attributes |= FileAttributes.ReadOnly;
|
||||
|
||||
// Backup needed flag
|
||||
if((entry.Access & BACKUP_ATTRIBUTE) != 0) attributes |= FileAttributes.Archive;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -90,8 +90,8 @@ public sealed partial class QNX4
|
||||
|
||||
while(bytesRead < inode.di_size)
|
||||
{
|
||||
var blockNum = currentOffset / QNX4_BLOCK_SIZE;
|
||||
var offsetInBlock = (int)(currentOffset % QNX4_BLOCK_SIZE);
|
||||
uint blockNum = currentOffset / QNX4_BLOCK_SIZE;
|
||||
var offsetInBlock = (int)(currentOffset % QNX4_BLOCK_SIZE);
|
||||
|
||||
errno = MapBlock(inode, blockNum, out uint physicalBlock);
|
||||
|
||||
@@ -278,20 +278,6 @@ public sealed partial class QNX4
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
ErrorNumber errno = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -278,20 +278,6 @@ public sealed partial class QNX6
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
ErrorNumber errno = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -39,23 +39,6 @@ namespace Aaru.Filesystems;
|
||||
/// <inheritdoc />
|
||||
public sealed partial class RBF
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.File;
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
// Use Stat to get the file information
|
||||
ErrorNumber errno = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -139,23 +139,6 @@ public sealed partial class RT11
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
// Use Stat to get file information
|
||||
ErrorNumber errno = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -261,23 +261,6 @@ public sealed partial class SFS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
// Use Stat to get the file information
|
||||
ErrorNumber errno = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -205,26 +205,6 @@ public sealed partial class PascalPlugin
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
ErrorNumber error = GetFileEntry(path, out _);
|
||||
|
||||
if(error != ErrorNumber.NoError) return error;
|
||||
|
||||
attributes = FileAttributes.File;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber OpenFile(string path, out IFileNode node)
|
||||
{
|
||||
|
||||
@@ -199,65 +199,6 @@ public sealed partial class UDF
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
ErrorNumber errno = GetFileEntryBuffer(path, out byte[] feBuffer);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
errno = ParseFileEntryInfo(feBuffer, out UdfFileEntryInfo fileEntryInfo);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
// Set file attributes based on file type
|
||||
switch(fileEntryInfo.IcbTag.fileType)
|
||||
{
|
||||
case FileType.Directory:
|
||||
attributes |= FileAttributes.Directory;
|
||||
|
||||
break;
|
||||
case FileType.SymbolicLink:
|
||||
attributes |= FileAttributes.Symlink;
|
||||
|
||||
break;
|
||||
case FileType.BlockDevice:
|
||||
attributes |= FileAttributes.BlockDevice;
|
||||
|
||||
break;
|
||||
case FileType.CharacterDevice:
|
||||
attributes |= FileAttributes.CharDevice;
|
||||
|
||||
break;
|
||||
case FileType.Fifo:
|
||||
attributes |= FileAttributes.Pipe;
|
||||
|
||||
break;
|
||||
case FileType.Socket:
|
||||
attributes |= FileAttributes.Socket;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Set attributes based on flags
|
||||
if(fileEntryInfo.IcbTag.flags.HasFlag(FileFlags.System)) attributes |= FileAttributes.System;
|
||||
|
||||
if(fileEntryInfo.IcbTag.flags.HasFlag(FileFlags.Archive)) attributes |= FileAttributes.Archive;
|
||||
|
||||
// Check for hidden flag in file characteristics (from directory entry)
|
||||
// We need to check if the file was marked as hidden in its directory entry
|
||||
errno = GetFileCharacteristics(path, out FileCharacteristics characteristics);
|
||||
|
||||
if(errno == ErrorNumber.NoError && characteristics.HasFlag(FileCharacteristics.Hidden))
|
||||
attributes |= FileAttributes.Hidden;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber ReadLink(string path, out string dest)
|
||||
{
|
||||
|
||||
@@ -195,20 +195,6 @@ public sealed partial class BFS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
ErrorNumber errno = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -106,7 +106,7 @@ public sealed partial class Xia
|
||||
while(bytesRead < inode.i_size)
|
||||
{
|
||||
uint zoneSize = _superblock.s_zone_size;
|
||||
var zoneNum = currentOffset / zoneSize;
|
||||
uint zoneNum = currentOffset / zoneSize;
|
||||
var offsetInZone = (int)(currentOffset % zoneSize);
|
||||
|
||||
errno = MapZone(inode, zoneNum, out uint physicalZone);
|
||||
@@ -306,23 +306,6 @@ public sealed partial class Xia
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
// Use Stat to get file info including attributes
|
||||
ErrorNumber errno = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -150,38 +150,6 @@ public sealed partial class exFAT
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
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;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
@@ -272,23 +272,6 @@ public sealed partial class extFS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = FileAttributes.None;
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
// Use Stat to get file info including attributes
|
||||
ErrorNumber errno = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
attributes = stat.Attributes;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user