mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 15:46:05 +02:00
Properly setting mFileAccess
This commit is contained in:
parent
6512841cf1
commit
d7aa91f9c5
1 changed files with 13 additions and 5 deletions
|
@ -96,7 +96,6 @@ namespace System.IO
|
||||||
{
|
{
|
||||||
mBfpFile = handle;
|
mBfpFile = handle;
|
||||||
mFileAccess = access;
|
mFileAccess = access;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanRead
|
public override bool CanRead
|
||||||
|
@ -115,12 +114,12 @@ namespace System.IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result<void, FileOpenError> Create(StringView path, FileAccess access = .ReadWrite, FileShare share = .None, int bufferSize = 4096, FileOptions options= .None, SecurityAttributes* secAttrs = null)
|
public Result<void, FileOpenError> Create(StringView path, FileAccess access = .ReadWrite, FileShare share = .None, int bufferSize = 4096, FileOptions options = .None, SecurityAttributes* secAttrs = null)
|
||||||
{
|
{
|
||||||
return Open(path, FileMode.Create, access, share, bufferSize, options, secAttrs);
|
return Open(path, FileMode.Create, access, share, bufferSize, options, secAttrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result<void, FileOpenError> Open(StringView path, FileAccess access = .ReadWrite, FileShare share = .None, int bufferSize = 4096, FileOptions options= .None, SecurityAttributes* secAttrs = null)
|
public Result<void, FileOpenError> Open(StringView path, FileAccess access = .ReadWrite, FileShare share = .None, int bufferSize = 4096, FileOptions options = .None, SecurityAttributes* secAttrs = null)
|
||||||
{
|
{
|
||||||
return Open(path, FileMode.Open, access, share, bufferSize, options, secAttrs);
|
return Open(path, FileMode.Open, access, share, bufferSize, options, secAttrs);
|
||||||
}
|
}
|
||||||
|
@ -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))
|
||||||
{
|
{
|
||||||
|
@ -145,7 +145,7 @@ namespace System.IO
|
||||||
return .Ok;
|
return .Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result<void, FileOpenError> Open(StringView path, FileMode mode, FileAccess access, FileShare share = .None, int bufferSize = 4096, FileOptions options= .None, SecurityAttributes* secAttrs = null)
|
public Result<void, FileOpenError> Open(StringView path, FileMode mode, FileAccess access, FileShare share = .None, int bufferSize = 4096, FileOptions options = .None, SecurityAttributes* secAttrs = null)
|
||||||
{
|
{
|
||||||
Runtime.Assert(mBfpFile == null);
|
Runtime.Assert(mBfpFile == null);
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue