| 56 | } |
| 57 | |
| 58 | void writeToFile(slice s, const char *path, int mode) { |
| 59 | int fd = ::_open(path, mode | O_WRONLY | O_BINARY, 0600); |
| 60 | if (fd < 0) |
| 61 | FleeceException::_throwErrno("Can't open file"); |
| 62 | ssize_t written = narrow_cast<ssize_t>(::_write(fd, s.buf, narrow_cast<unsigned int>(s.size))); |
| 63 | if(written < narrow_cast<ssize_t>(s.size)) |
| 64 | FleeceException::_throwErrno("Can't write file"); |
| 65 | ::_close(fd); |
| 66 | } |
| 67 | |
| 68 | void writeToFile(slice s, const char *path) { |
| 69 | writeToFile(s, path, O_CREAT | O_TRUNC); |
no outgoing calls
no test coverage detected