91 lines
2.1 KiB
C
91 lines
2.1 KiB
C
#pragma once
|
|
#include "core/core_basic.h"
|
|
#include "core/core_string.h"
|
|
|
|
typedef struct os_date_t os_date_t;
|
|
struct os_date_t {
|
|
u16 ms;
|
|
u16 sec;
|
|
u16 min;
|
|
u16 hour;
|
|
u16 day;
|
|
u16 month;
|
|
u16 year;
|
|
};
|
|
|
|
typedef struct os_iter_t os_iter_t;
|
|
struct os_iter_t {
|
|
s8_t abs;
|
|
s8_t rel;
|
|
s8_t name;
|
|
b8 is_directory;
|
|
b8 is_valid;
|
|
|
|
s8_t path;
|
|
ma_arena_t *arena;
|
|
|
|
union {
|
|
struct w32_file_iter_t *w32;
|
|
void *platform;
|
|
void *unix_dir;
|
|
};
|
|
};
|
|
|
|
typedef enum {
|
|
os_mkdir_success,
|
|
os_mkdir_file_exists,
|
|
os_mkdir_path_not_found,
|
|
os_mkdir_other_error,
|
|
} os_mkdir_t;
|
|
|
|
typedef enum {
|
|
os_write_success,
|
|
os_write_path_not_found,
|
|
os_write_other_error,
|
|
} os_write_t;
|
|
|
|
fn os_date_t os_local_time(void);
|
|
fn os_date_t os_universal_time(void);
|
|
fn s8_t os_format_date(ma_arena_t *arena, os_date_t date);
|
|
fn f64 os_seconds(void);
|
|
fn f64 os_milliseconds(void);
|
|
fn f64 os_get_microseconds(void);
|
|
|
|
fn b32 os_copy(s8_t from, s8_t to, b32 overwrite);
|
|
fn b32 os_delete(s8_t path);
|
|
fn os_mkdir_t os_mkdir(s8_t path);
|
|
fn os_write_t os_write(s8_t path, s8_t content);
|
|
fn s8_t os_read(ma_arena_t *arena, s8_t path);
|
|
|
|
fn void os_advance(os_iter_t *it);
|
|
fn os_iter_t *os_iter(ma_arena_t *arena, s8_t path);
|
|
|
|
fn i64 os_mod_time(s8_t file);
|
|
fn s8_t os_abs(ma_arena_t *arena, s8_t rel);
|
|
fn s8_t os_exe(ma_arena_t *arena);
|
|
fn s8_t os_exe_dir(ma_arena_t *arena);
|
|
fn b32 os_is_dir(s8_t path);
|
|
fn b32 os_is_file(s8_t path);
|
|
fn b32 os_is_abs(s8_t path);
|
|
fn b32 os_exists(s8_t path);
|
|
|
|
fn s8_t os_cwd(ma_arena_t *arena);
|
|
fn void os_set_cwd(s8_t new_cwd);
|
|
|
|
fn s8_t os_appdata(ma_arena_t *arena, s8_t name);
|
|
|
|
|
|
typedef i32 os_thread_fn_t(void *user_data);
|
|
typedef struct os_thread_t os_thread_t;
|
|
struct os_thread_t {
|
|
b32 exited;
|
|
i32 exit_code;
|
|
union {
|
|
struct w32_thread_t *w32;
|
|
void *ptr;
|
|
};
|
|
};
|
|
|
|
fn os_thread_t os_thread_create(ma_arena_t *arena, os_thread_fn_t *func, void *user_data);
|
|
fn i32 os_thread_wait_for_exit(os_thread_t *thread);
|