|
| 1 | +using System.Runtime.Versioning; |
| 2 | + |
| 3 | +namespace TruePath; |
| 4 | + |
| 5 | +public static class AbsoluteFile |
| 6 | +{ |
| 7 | + public static FileAttributes GetAttributes(AbsolutePath path) => File.GetAttributes(path.Value); |
| 8 | + public static DateTime GetCreationTime(AbsolutePath path) => File.GetCreationTime(path.Value); |
| 9 | + public static DateTime GetCreationTimeUtc(AbsolutePath path) => File.GetCreationTimeUtc(path.Value); |
| 10 | + public static DateTime GetLastAccessTime(AbsolutePath path) => File.GetLastAccessTime(path.Value); |
| 11 | + public static DateTime GetLastAccessTimeUtc(AbsolutePath path) => File.GetLastAccessTimeUtc(path.Value); |
| 12 | + public static DateTime GetLastWriteTime(AbsolutePath path) => File.GetLastWriteTime(path.Value); |
| 13 | + [UnsupportedOSPlatform("windows")] |
| 14 | + public static UnixFileMode GetUnixFileMode(AbsolutePath path) => File.GetUnixFileMode(path.Value); |
| 15 | + public static void Move(AbsolutePath sourceFile, AbsolutePath destFile) => File.Move(sourceFile.Value, destFile.Value); |
| 16 | + public static void Move(AbsolutePath sourceFile, AbsolutePath destFile, bool overwrite) => File.Move(sourceFile.Value, destFile.Value, overwrite); |
| 17 | + public static FileStream Open(AbsolutePath path, FileMode mode) => File.Open(path.Value, mode); |
| 18 | + public static FileStream Open(AbsolutePath path, FileMode mode, FileAccess access) => File.Open(path.Value, mode, access); |
| 19 | + public static FileStream Open(AbsolutePath path, FileMode mode, FileAccess access, FileShare share) => File.Open(path.Value, mode, access, share); |
| 20 | + public static FileStream OpenRead(AbsolutePath path) => File.OpenRead(path.Value); |
| 21 | + public static StreamReader OpenText(AbsolutePath path) => File.OpenText(path.Value); |
| 22 | + public static FileStream OpenWrite(AbsolutePath path) => File.OpenWrite(path.Value); |
| 23 | + public static byte[] ReadAllBytes(AbsolutePath path) => File.ReadAllBytes(path.Value); |
| 24 | + public static Task<byte[]> ReadAllBytesAsync(AbsolutePath path, CancellationToken cancellationToken = default) => File.ReadAllBytesAsync(path.Value, cancellationToken); |
| 25 | +} |
0 commit comments