2022-05-13 11:45:40 +00:00
|
|
|
#ifndef LUMENARIUM_LINUX_FILE_H
|
|
|
|
#define LUMENARIUM_LINUX_FILE_H 1
|
|
|
|
|
|
|
|
File_Async_Job_System
|
|
|
|
os_file_jobs_init()
|
|
|
|
{
|
2022-05-25 12:30:20 +00:00
|
|
|
return (File_Async_Job_System){};
|
2022-05-13 11:45:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
File_Handle
|
|
|
|
os_file_open(String path, File_Access_Flags flags_access, File_Create_Flags flags_create)
|
|
|
|
{
|
|
|
|
invalid_code_path;
|
2022-05-25 12:30:20 +00:00
|
|
|
return (File_Handle){};
|
2022-05-13 11:45:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
os_file_close(File_Handle file_handle)
|
|
|
|
{
|
|
|
|
invalid_code_path;
|
|
|
|
}
|
|
|
|
|
|
|
|
File_Info
|
|
|
|
os_file_get_info(File_Handle file_handle, Allocator* allocator)
|
|
|
|
{
|
|
|
|
invalid_code_path;
|
2022-05-25 12:30:20 +00:00
|
|
|
return (File_Info){};
|
2022-05-13 11:45:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Data
|
|
|
|
os_file_read_all(File_Handle file_handle, Allocator* allocator)
|
|
|
|
{
|
|
|
|
invalid_code_path;
|
2022-05-25 12:30:20 +00:00
|
|
|
return (Data){};
|
2022-05-13 11:45:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
os_file_write_all(File_Handle file_handle, Data file_data)
|
|
|
|
{
|
|
|
|
invalid_code_path;
|
2022-05-25 12:30:20 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
os_file_write(File_Handle file_handle, Data file_data)
|
|
|
|
{
|
|
|
|
invalid_code_path;
|
|
|
|
return false;
|
2022-05-13 11:45:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String
|
|
|
|
os_get_exe_path(Allocator* allocator)
|
|
|
|
{
|
2022-05-25 12:30:20 +00:00
|
|
|
String result = {};
|
|
|
|
char buf[PATH_MAX + 1];
|
|
|
|
s32 r = readlink("/proc/self/exe", buf, PATH_MAX);
|
|
|
|
if (r != -1)
|
|
|
|
{
|
|
|
|
u64 needed = c_str_len(buf);
|
|
|
|
result = allocator_alloc_string(allocator, needed + 1);
|
|
|
|
memory_copy((u8*)buf, result.str, needed);
|
|
|
|
result.len = needed;
|
|
|
|
result.str[result.len] = 0;
|
|
|
|
}
|
|
|
|
return result;
|
2022-05-13 11:45:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
os_pwd_set(String path)
|
|
|
|
{
|
2022-05-25 12:30:20 +00:00
|
|
|
s32 result = chdir((char*)path.str);
|
|
|
|
if (result == -1)
|
|
|
|
{
|
|
|
|
linux_err_print("chdir");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
2022-05-13 11:45:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
File_Info_List
|
|
|
|
os_dir_enum(String path, Platform_Enum_Dir_Flags flags, Allocator* allocator)
|
|
|
|
{
|
|
|
|
invalid_code_path;
|
2022-05-25 12:30:20 +00:00
|
|
|
return (File_Info_List){};
|
2022-05-13 11:45:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
os_file_async_work_on_job(File_Async_Job* job)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // LUMENARIUM_LINUX_FILE_H
|