mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-03 20:38:40 +00:00
non-helper os_properties_from_file_path - can use accelerated path here which just looks at path for properties, rather than having to open a handle; also tweak txti layer to gracefully fail if a write happened between its load of file data
This commit is contained in:
@@ -1198,6 +1198,14 @@ os_file_path_exists(String8 path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal FileProperties
|
||||
os_properties_from_file_path(String8 path)
|
||||
{
|
||||
FileProperties props = {0};
|
||||
NotImplemented;
|
||||
return props;
|
||||
}
|
||||
|
||||
//- rjf: file maps
|
||||
|
||||
internal OS_Handle
|
||||
|
||||
@@ -126,15 +126,6 @@ os_write_data_list_to_file_path(String8 path, String8List list)
|
||||
return good;
|
||||
}
|
||||
|
||||
internal FileProperties
|
||||
os_properties_from_file_path(String8 path)
|
||||
{
|
||||
OS_Handle file = os_file_open(OS_AccessFlag_Read|OS_AccessFlag_ShareRead, path);
|
||||
FileProperties props = os_properties_from_file(file);
|
||||
os_file_close(file);
|
||||
return props;
|
||||
}
|
||||
|
||||
internal OS_FileID
|
||||
os_id_from_file_path(String8 path)
|
||||
{
|
||||
|
||||
@@ -176,7 +176,6 @@ internal void os_relaunch_self(void);
|
||||
internal String8 os_data_from_file_path(Arena *arena, String8 path);
|
||||
internal B32 os_write_data_to_file_path(String8 path, String8 data);
|
||||
internal B32 os_write_data_list_to_file_path(String8 path, String8List list);
|
||||
internal FileProperties os_properties_from_file_path(String8 path);
|
||||
internal OS_FileID os_id_from_file_path(String8 path);
|
||||
internal S64 os_file_id_compare(OS_FileID a, OS_FileID b);
|
||||
internal String8 os_string_from_file_range(Arena *arena, OS_Handle file, Rng1U64 range);
|
||||
@@ -260,6 +259,7 @@ internal B32 os_delete_file_at_path(String8 path);
|
||||
internal B32 os_copy_file_path(String8 dst, String8 src);
|
||||
internal String8 os_full_path_from_path(Arena *arena, String8 path);
|
||||
internal B32 os_file_path_exists(String8 path);
|
||||
internal FileProperties os_properties_from_file_path(String8 path);
|
||||
|
||||
//- rjf: file maps
|
||||
internal OS_Handle os_file_map_open(OS_AccessFlags flags, OS_Handle file);
|
||||
|
||||
@@ -791,6 +791,25 @@ os_file_path_exists(String8 path)
|
||||
return exists;
|
||||
}
|
||||
|
||||
internal FileProperties
|
||||
os_properties_from_file_path(String8 path)
|
||||
{
|
||||
WIN32_FIND_DATAW find_data = {0};
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String16 path16 = str16_from_8(scratch.arena, path);
|
||||
HANDLE handle = FindFirstFileW((WCHAR *)path16.str, &find_data);
|
||||
FindClose(handle);
|
||||
FileProperties props = {0};
|
||||
{
|
||||
props.size = Compose64Bit(find_data.nFileSizeHigh, find_data.nFileSizeLow);
|
||||
w32_dense_time_from_file_time(&props.created, &find_data.ftCreationTime);
|
||||
w32_dense_time_from_file_time(&props.modified, &find_data.ftLastWriteTime);
|
||||
props.flags = w32_file_property_flags_from_dwFileAttributes(find_data.dwFileAttributes);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return props;
|
||||
}
|
||||
|
||||
//- rjf: file maps
|
||||
|
||||
internal OS_Handle
|
||||
|
||||
Reference in New Issue
Block a user