1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-20 00:50:25 +02:00

Add doAppend parameter to WriteAllLines

This commit is contained in:
disarray2077 2022-01-01 21:19:44 -03:00 committed by GitHub
parent bc92643c99
commit 4acc2cca67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -107,7 +107,7 @@ namespace System.IO
return .Ok;
}
public static Result<void> WriteAllLines(StringView path, IEnumerator<StringView> enumerator)
public static Result<void> WriteAllLines(StringView path, IEnumerator<StringView> enumerator, bool doAppend = false)
{
String strBuf = scope String();
for (var str in enumerator)
@ -115,10 +115,10 @@ namespace System.IO
strBuf.Append(str);
strBuf.Append(Environment.NewLine);
}
return WriteAllText(path, strBuf);
return WriteAllText(path, strBuf, doAppend);
}
public static Result<void> WriteAllLines(StringView path, IEnumerator<String> enumerator)
public static Result<void> WriteAllLines(StringView path, IEnumerator<String> enumerator, bool doAppend = false)
{
String strBuf = scope String();
for (var str in enumerator)
@ -126,7 +126,7 @@ namespace System.IO
strBuf.Append(str);
strBuf.Append(Environment.NewLine);
}
return WriteAllText(path, strBuf);
return WriteAllText(path, strBuf, doAppend);
}
/*public static Result<IEnumerator<Result<String>>> ReadLines(String fileName)