-
-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4da424a
commit 9ae1583
Showing
20 changed files
with
300 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using Sentry.Extensibility; | ||
|
||
namespace Sentry.Internal; | ||
|
||
internal class ReadOnlyFileSystem : IFileSystem | ||
{ | ||
public IEnumerable<string> EnumerateFiles(string path) => Directory.EnumerateFiles(path); | ||
|
||
public IEnumerable<string> EnumerateFiles(string path, string searchPattern) => | ||
Directory.EnumerateFiles(path, searchPattern); | ||
|
||
public IEnumerable<string> EnumerateFiles(string path, string searchPattern, SearchOption searchOption) => | ||
Directory.EnumerateFiles(path, searchPattern, searchOption); | ||
|
||
public FileOperationResult CreateDirectory(string path) => FileOperationResult.Disabled; | ||
|
||
public FileOperationResult DeleteDirectory(string path, bool recursive = false) => FileOperationResult.Disabled; | ||
|
||
public bool DirectoryExists(string path) => Directory.Exists(path); | ||
|
||
public bool FileExists(string path) => File.Exists(path); | ||
|
||
public FileOperationResult MoveFile(string sourceFileName, string destFileName, bool overwrite = false) => | ||
FileOperationResult.Disabled; | ||
|
||
public FileOperationResult DeleteFile(string path) => FileOperationResult.Disabled; | ||
|
||
public DateTimeOffset GetFileCreationTime(string path) => new FileInfo(path).CreationTimeUtc; | ||
|
||
public string ReadAllTextFromFile(string path) => File.ReadAllText(path); | ||
|
||
public Stream OpenFileForReading(string path) => File.OpenRead(path); | ||
|
||
public Stream OpenFileForReading(string path, | ||
bool useAsync, | ||
FileMode fileMode = FileMode.Open, | ||
FileAccess fileAccess = FileAccess.Read, | ||
FileShare fileShare = FileShare.ReadWrite, | ||
int bufferSize = 4096) | ||
{ | ||
return new FileStream( | ||
path, | ||
fileMode, | ||
fileAccess, | ||
fileShare, | ||
bufferSize: bufferSize, | ||
useAsync: useAsync); | ||
} | ||
|
||
public (FileOperationResult, Stream) CreateFileForWriting(string path) => (FileOperationResult.Disabled, Stream.Null); | ||
|
||
public FileOperationResult WriteAllTextToFile(string path, string contents) | ||
{ | ||
File.WriteAllText(path, contents); | ||
return File.Exists(path) ? FileOperationResult.Success : FileOperationResult.Failure; | ||
} | ||
} |
Oops, something went wrong.