Using arena as token array, remove arenas idea
This commit is contained in:
@@ -161,10 +161,10 @@ os_get_exe_dir(Allocator *a){
|
||||
CORE_Static String
|
||||
os_get_absolute_path(Allocator *a, String path){
|
||||
char buff[2048];
|
||||
Scratch_Arena *scratch = make_scratch_arena(buff, 2048);
|
||||
String16 path16 = string8_to_string16(scratch, path);
|
||||
Arena scratch = arena_from_buffer(buff, 2048);
|
||||
String16 path16 = string8_to_string16(&scratch, path);
|
||||
|
||||
wchar_t *buffer = allocate_array(scratch, wchar_t, 512);
|
||||
wchar_t *buffer = allocate_array(&scratch, wchar_t, 512);
|
||||
DWORD written = GetFullPathNameW((wchar_t *)path16.str, 512, buffer, 0);
|
||||
if(written == 0) return {};
|
||||
|
||||
@@ -177,15 +177,15 @@ os_get_absolute_path(Allocator *a, String path){
|
||||
CORE_Static B32
|
||||
os_does_file_exist(String path){
|
||||
char buff[2048];
|
||||
Scratch_Arena *scratch = make_scratch_arena(buff, buff_cap(buff));
|
||||
String16 path16 = string8_to_string16(scratch, path);
|
||||
Arena scratch = arena_from_buffer(buff, buff_cap(buff));
|
||||
String16 path16 = string8_to_string16(&scratch, path);
|
||||
DWORD attribs = GetFileAttributesW((wchar_t *)path16.str);
|
||||
B32 result = attribs == INVALID_FILE_ATTRIBUTES ? false : true;
|
||||
return result;
|
||||
}
|
||||
|
||||
CORE_Static Array<OS_File_Info>
|
||||
os_list_dir(Scratch_Arena *scratch, Allocator *a, String dir, U32 flags = LIST_NO_FLAGS){
|
||||
os_list_dir(Arena *scratch, Allocator *a, String dir, U32 flags = LIST_NO_FLAGS){
|
||||
Scratch_Scope _scope(scratch);
|
||||
Array<String> dirs_to_read = {scratch};
|
||||
dirs_to_read.add(dir);
|
||||
|
||||
Reference in New Issue
Block a user