| | 1 | | using System; |
| | 2 | | using System.IO; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | namespace DCL |
| | 6 | | { |
| | 7 | | public static partial class SystemWrappers |
| | 8 | | { |
| | 9 | | public class File : IFile |
| | 10 | | { |
| | 11 | | public void Delete(string path) |
| | 12 | | { |
| | 13 | | try |
| | 14 | | { |
| 0 | 15 | | System.IO.File.Delete(path); |
| 0 | 16 | | } |
| 0 | 17 | | catch (Exception e) |
| | 18 | | { |
| 0 | 19 | | Debug.LogError($"Error trying to delete file {path}!\n{e.Message}"); |
| 0 | 20 | | } |
| 0 | 21 | | } |
| | 22 | |
|
| 0 | 23 | | public bool Exists(string path) { return System.IO.File.Exists(path); } |
| | 24 | |
|
| 0 | 25 | | public void Copy(string srcPath, string dstPath) { System.IO.File.Copy(srcPath, dstPath); } |
| | 26 | |
|
| 0 | 27 | | public void Move(string srcPath, string dstPath) { System.IO.File.Move(srcPath, dstPath); } |
| | 28 | |
|
| 0 | 29 | | public string ReadAllText(string path) { return System.IO.File.ReadAllText(path); } |
| | 30 | |
|
| 0 | 31 | | public void WriteAllText(string path, string text) { System.IO.File.WriteAllText(path, text); } |
| | 32 | |
|
| 0 | 33 | | public void WriteAllBytes(string path, byte[] bytes) { System.IO.File.WriteAllBytes(path, bytes); } |
| | 34 | |
|
| 0 | 35 | | public Stream OpenRead(string path) { return System.IO.File.OpenRead(path); } |
| | 36 | | } |
| | 37 | | } |
| | 38 | | } |