1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 15:26:00 +02:00

Merge pull request #1130 from disarray2077/fix_ide_textwrites

Fix issues with the methods for writing files
This commit is contained in:
Brian Fiete 2021-08-02 11:01:50 -07:00 committed by GitHub
commit 3cd94cbc8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 142 additions and 63 deletions

View file

@ -295,11 +295,13 @@ namespace Beefy
public static Result<void> WriteTextFile(StringView path, StringView text)
{
var stream = scope FileStream();
if (stream.Create(path) case .Err)
{
var stream = scope UnbufferedFileStream();
if (stream.Open(path, .OpenOrCreate, .Write) case .Err)
return .Err;
}
if (stream.SetLength(text.Length) case .Err)
return .Err;
if (stream.WriteStrUnsized(text) case .Err)
return .Err;