| 1293 | #endif |
| 1294 | |
| 1295 | std::span<const u8> FileSystem::MapBinaryFileForRead(const char* path) |
| 1296 | { |
| 1297 | #ifdef _WIN32 |
| 1298 | const std::wstring wpath = GetWin32Path(path); |
| 1299 | HANDLE handle = CreateFileW(wpath.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); |
| 1300 | if (handle == INVALID_HANDLE_VALUE) |
| 1301 | return {}; |
| 1302 | std::span<const u8> result = ::MapBinaryFileForRead(handle); |
| 1303 | CloseHandle(handle); |
| 1304 | return result; |
| 1305 | #else |
| 1306 | int fd = open(path, O_RDONLY); |
| 1307 | if (fd <= 0) |
| 1308 | return {}; |
| 1309 | std::span<const u8> result = ::MapBinaryFileForRead(fd); |
| 1310 | close(fd); |
| 1311 | return result; |
| 1312 | #endif |
| 1313 | } |
| 1314 | |
| 1315 | std::span<const u8> FileSystem::MapBinaryFileForRead(std::FILE* fp) |
| 1316 | { |
nothing calls this directly
no test coverage detected