1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-17 23:56:05 +02:00

Properly setting mFileAccess

This commit is contained in:
Brian Fiete 2020-02-29 07:47:44 -08:00
parent 6512841cf1
commit d7aa91f9c5

View file

@ -96,7 +96,6 @@ namespace System.IO
{ {
mBfpFile = handle; mBfpFile = handle;
mFileAccess = access; mFileAccess = access;
} }
public override bool CanRead public override bool CanRead
@ -129,6 +128,7 @@ namespace System.IO
{ {
Platform.BfpFileResult fileResult = .Ok; Platform.BfpFileResult fileResult = .Ok;
mBfpFile = Platform.BfpFile_GetStd(stdKind, &fileResult); mBfpFile = Platform.BfpFile_GetStd(stdKind, &fileResult);
mFileAccess = .ReadWrite;
if ((mBfpFile == null) || (fileResult != .Ok)) if ((mBfpFile == null) || (fileResult != .Ok))
{ {
@ -199,14 +199,22 @@ namespace System.IO
return .Err(.Unknown); return .Err(.Unknown);
} }
} }
mFileAccess = access;
return .Ok; return .Ok;
} }
public void Attach(Platform.BfpFile* bfpFile) public void Attach(Platform.BfpFile* bfpFile, FileAccess access = .ReadWrite)
{ {
Close(); Close();
mBfpFile = bfpFile; mBfpFile = bfpFile;
mFileAccess = access;
}
public override void Close()
{
base.Close();
mFileAccess = default;
} }
} }
} }