| 9 | #include "Engine/Profiler/ProfilerCPU.h" |
| 10 | |
| 11 | bool FileBase::ReadAllBytes(const StringView& path, void* data, int32 length) |
| 12 | { |
| 13 | PROFILE_CPU_NAMED("File::ReadAllBytes"); |
| 14 | ZoneText(*path, path.Length()); |
| 15 | bool result = true; |
| 16 | auto file = File::Open(path, FileMode::OpenExisting, FileAccess::Read, FileShare::All); |
| 17 | if (file) |
| 18 | { |
| 19 | const uint32 size = Math::Min<uint32>(file->GetSize(), length); |
| 20 | if (size > 0) |
| 21 | { |
| 22 | result = file->Read(data, size) != 0; |
| 23 | } |
| 24 | else |
| 25 | { |
| 26 | result = false; |
| 27 | } |
| 28 | Delete(file); |
| 29 | } |
| 30 | return result; |
| 31 | } |
| 32 | |
| 33 | bool FileBase::ReadAllBytes(const StringView& path, Array<byte>& data) |
| 34 | { |