Files
sharpemu/src/SharpEmu.Core/PhysicalFileSystem.cs
T
ParantezTech 4d73f469bc initial commit
2026-03-11 15:48:28 +03:00

38 lines
775 B
C#

// Copyright (C) 2026 SharpEmu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
namespace SharpEmu.Core;
public sealed class PhysicalFileSystem : IFileSystem
{
public bool Exists(string path)
{
if (string.IsNullOrWhiteSpace(path))
return false;
return File.Exists(path);
}
public bool TryReadAllBytes(string path, out byte[] data)
{
data = Array.Empty<byte>();
if (string.IsNullOrWhiteSpace(path))
return false;
if (!File.Exists(path))
return false;
try
{
data = File.ReadAllBytes(path);
return true;
}
catch
{
data = Array.Empty<byte>();
return false;
}
}
}