mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-05 05:18:40 +00:00
pre-allocate file size before write
This commit is contained in:
@@ -494,6 +494,19 @@ os_rename_file_by_handle(OS_Handle file, String8 new_name)
|
||||
return is_renamed;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_file_reserve_size(OS_Handle file, U64 size)
|
||||
{
|
||||
HANDLE handle = (HANDLE)file.u64[0];
|
||||
|
||||
FILE_ALLOCATION_INFO alloc_info = {0};
|
||||
alloc_info.AllocationSize.LowPart = size & max_U32;
|
||||
alloc_info.AllocationSize.HighPart = (size >> 32) & max_U32;
|
||||
|
||||
BOOL is_reserved = SetFileInformationByHandle(handle, FileAllocationInfo, &alloc_info, sizeof(alloc_info));
|
||||
return is_reserved;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_delete_file_at_path(String8 path)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user