[FileAccess] Return error codes from store_* methods.

This commit is contained in:
bruvzg 2023-06-15 21:21:43 +03:00 committed by Pāvels Nadtočajevs
parent 56a7dba10b
commit a4b17e7852
30 changed files with 279 additions and 138 deletions

View file

@ -295,10 +295,10 @@ void FileAccessUnix::flush() {
fflush(f);
}
void FileAccessUnix::store_buffer(const uint8_t *p_src, uint64_t p_length) {
ERR_FAIL_NULL_MSG(f, "File must be opened before use.");
ERR_FAIL_COND(!p_src && p_length > 0);
ERR_FAIL_COND(fwrite(p_src, 1, p_length, f) != p_length);
bool FileAccessUnix::store_buffer(const uint8_t *p_src, uint64_t p_length) {
ERR_FAIL_NULL_V_MSG(f, false, "File must be opened before use.");
ERR_FAIL_COND_V(!p_src && p_length > 0, false);
return fwrite(p_src, 1, p_length, f) == p_length;
}
bool FileAccessUnix::file_exists(const String &p_path) {