From fc5886c75ab2626acbc0d7b3db475d17d2cbe01f Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Tue, 11 Jul 2023 18:37:45 -0700 Subject: Add filesystem library. --- filesystem/include/filesystem.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 filesystem/include/filesystem.h (limited to 'filesystem/include') diff --git a/filesystem/include/filesystem.h b/filesystem/include/filesystem.h new file mode 100644 index 0000000..62bd7f0 --- /dev/null +++ b/filesystem/include/filesystem.h @@ -0,0 +1,19 @@ +/* + * Various filesystem utilities. + */ +#pragma once + +#include +#include +#include + +/// Get the file's size. +size_t get_file_size(FILE* file); + +/// Read the entire contents of the file into memory. +void* read_file(const char* filepath); + +/// Make a path relative to the parent directory of a file. +bool make_relative_path( + size_t max_path_length, const char* filepath, const char* path, + char* relative); -- cgit v1.2.3