1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-03 06:45:59 +02:00

Change to allow working in installer

This commit is contained in:
Brian Fiete 2019-09-10 11:25:53 -07:00
parent 5c813f31ec
commit 463e26ff75
19 changed files with 571 additions and 57 deletions

View file

@ -11,6 +11,10 @@ namespace System.IO
public bool AutoFlush;
public this()
{
}
public this(Stream stream, Encoding encoding, int32 bufferSize, bool ownsStream = false)
{
Debug.Assert(encoding != null);
@ -19,6 +23,21 @@ namespace System.IO
mOwnsStream = ownsStream;
}
public Result<void, FileOpenError> Create(StringView fileName)
{
Debug.Assert(mStream == null);
var fileStream = new FileStream();
mStream = fileStream;
mEncoding = .UTF8;
mOwnsStream = true;
if (fileStream.Open(fileName, FileMode.Create, FileAccess.Write, FileShare.ReadWrite) case .Err(let err))
return .Err(err);
return .Ok;
}
public Result<void> Write(Span<uint8> data)
{
var spanLeft = data;