| 233 | } |
| 234 | |
| 235 | bool FileBase::WriteAllBytes(const StringView& path, const void* data, int32 length) |
| 236 | { |
| 237 | PROFILE_CPU_NAMED("File::WriteAllBytes"); |
| 238 | ZoneText(*path, path.Length()); |
| 239 | bool result = true; |
| 240 | auto file = File::Open(path, FileMode::CreateAlways, FileAccess::Write, FileShare::All); |
| 241 | if (file) |
| 242 | { |
| 243 | if (length > 0) |
| 244 | result = file->Write(data, length) != 0; |
| 245 | else |
| 246 | result = false; |
| 247 | |
| 248 | Delete(file); |
| 249 | } |
| 250 | return result; |
| 251 | } |
| 252 | |
| 253 | bool FileBase::WriteAllBytes(const StringView& path, const Array<byte>& data) |
| 254 | { |