mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Some StringViewification
This commit is contained in:
parent
a215bac755
commit
9fabf0f7ee
2 changed files with 3 additions and 4 deletions
|
@ -157,15 +157,14 @@ namespace Beefy
|
||||||
return .Ok;
|
return .Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result<void, FileError> LoadTextFile(String fileName, String outBuffer, bool autoRetry = true, delegate void() onPreFilter = null)
|
public static Result<void, FileError> LoadTextFile(StringView filePath, String outBuffer, bool autoRetry = true, delegate void() onPreFilter = null)
|
||||||
{
|
{
|
||||||
FileStream sr = scope .();
|
FileStream sr = scope .();
|
||||||
|
|
||||||
|
|
||||||
// Retry for a while if the other side is still writing out the file
|
// Retry for a while if the other side is still writing out the file
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
if (sr.Open(fileName, .Read, .Read) case .Err(let fileOpenErr))
|
if (sr.Open(filePath, .Read, .Read) case .Err(let fileOpenErr))
|
||||||
{
|
{
|
||||||
bool retry = false;
|
bool retry = false;
|
||||||
if (autoRetry)
|
if (autoRetry)
|
||||||
|
|
|
@ -254,7 +254,7 @@ namespace System.IO
|
||||||
return (char8[]) InvalidFileNameChars.Clone();
|
return (char8[]) InvalidFileNameChars.Clone();
|
||||||
} */
|
} */
|
||||||
|
|
||||||
public static void GetFileNameWithoutExtension(String inPath, String outFileName)
|
public static void GetFileNameWithoutExtension(StringView inPath, String outFileName)
|
||||||
{
|
{
|
||||||
int lastSlash = Math.Max(inPath.LastIndexOf('\\'), inPath.LastIndexOf('/'));
|
int lastSlash = Math.Max(inPath.LastIndexOf('\\'), inPath.LastIndexOf('/'));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue