|
@@ -9,6 +9,7 @@ public interface ILuaFileSystem
|
|
|
public IStream? Open(string path, LuaFileOpenMode mode, bool throwError);
|
|
public IStream? Open(string path, LuaFileOpenMode mode, bool throwError);
|
|
|
public void Rename(string oldName, string newName);
|
|
public void Rename(string oldName, string newName);
|
|
|
public void Remove(string path);
|
|
public void Remove(string path);
|
|
|
|
|
+ public string DirectorySeparator { get; }
|
|
|
public string GetTempFileName();
|
|
public string GetTempFileName();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -33,18 +34,6 @@ public interface IStream : IDisposable
|
|
|
public long Position { get; set; }
|
|
public long Position { get; set; }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-public interface IStreamReader : IDisposable
|
|
|
|
|
-{
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-public interface IStreamWriter : IDisposable
|
|
|
|
|
-{
|
|
|
|
|
- public ValueTask WriteAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken);
|
|
|
|
|
- public ValueTask FlushAsync(CancellationToken cancellationToken);
|
|
|
|
|
-
|
|
|
|
|
- public void SetVBuf(string mode, int size);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
public sealed class FileSystem : ILuaFileSystem
|
|
public sealed class FileSystem : ILuaFileSystem
|
|
|
{
|
|
{
|
|
|
public static readonly FileSystem Instance = new();
|
|
public static readonly FileSystem Instance = new();
|
|
@@ -113,6 +102,9 @@ public sealed class FileSystem : ILuaFileSystem
|
|
|
File.Delete(path);
|
|
File.Delete(path);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ static readonly string directorySeparator = Path.DirectorySeparatorChar.ToString();
|
|
|
|
|
+ public string DirectorySeparator => directorySeparator;
|
|
|
|
|
+
|
|
|
public string GetTempFileName()
|
|
public string GetTempFileName()
|
|
|
{
|
|
{
|
|
|
return Path.GetTempFileName();
|
|
return Path.GetTempFileName();
|