| 1485 | } |
| 1486 | |
| 1487 | bool gdre::is_macho_binary(const String &p_path) { |
| 1488 | Ref<FileAccess> fa = FileAccess::open(p_path, FileAccess::READ); |
| 1489 | if (fa.is_null()) { |
| 1490 | return false; |
| 1491 | } |
| 1492 | uint8_t header[4]; |
| 1493 | fa->get_buffer(header, 4); |
| 1494 | fa->close(); |
| 1495 | if ((header[0] == 0xcf || header[0] == 0xce) && header[1] == 0xfa && header[2] == 0xed && header[3] == 0xfe) { |
| 1496 | return true; |
| 1497 | } |
| 1498 | |
| 1499 | // handle fat binaries |
| 1500 | // always stored in big-endian format |
| 1501 | if (header[0] == 0xca && header[1] == 0xfe && header[2] == 0xba && header[3] == 0xbe) { |
| 1502 | return true; |
| 1503 | } |
| 1504 | // handle big-endian mach-o binaries |
| 1505 | if (header[0] == 0xfe && header[1] == 0xed && header[2] == 0xfa && (header[3] == 0xce || header[3] == 0xcf)) { |
| 1506 | return true; |
| 1507 | } |
| 1508 | |
| 1509 | return false; |
| 1510 | } |
| 1511 | |
| 1512 | bool gdre::is_fs_path(const String &p_path) { |
| 1513 | if (!p_path.is_absolute_path()) { |
nothing calls this directly
no test coverage detected