| 37 | } |
| 38 | |
| 39 | bool file::is_file(const path &path) |
| 40 | { |
| 41 | #if OS_WIN |
| 42 | DWORD attr = GetFileAttributesW(path.wstring().c_str()); |
| 43 | if (attr == INVALID_FILE_ATTRIBUTES) |
| 44 | return false; |
| 45 | return !(attr & FILE_ATTRIBUTE_DIRECTORY); |
| 46 | #elif OS_MAC |
| 47 | struct stat buffer; |
| 48 | if (stat(path.string().c_str(), &buffer) == 0) { |
| 49 | return S_ISREG(buffer.st_mode); |
| 50 | } |
| 51 | return false; |
| 52 | #endif |
| 53 | } |
| 54 | |
| 55 | bool file::read_file(const path &path, void **buffer, size_t *length) |
| 56 | { |