#pragma once #include #include #include typedef enum { SUCCESS, FAILURE } Result; typedef enum { LOG_LEVEL_DEBUG, LOG_LEVEL_INFO, LOG_LEVEL_WARNING, LOG_LEVEL_ERROR, } LogLevel; extern LogLevel LOG_LEVEL; void SetLogLevel(LogLevel level); void Log(LogLevel level, const char* format, ...); Result Format(char** _string, const char* fmt, ...); Result Duplicate(const char* string, char** _duplicate); Result Substring(const char* string, size_t start, size_t end, char** _substring); Result FormatSize(uint64_t size, char** _size_str); Result ParseSize(const char* size_str, uint64_t* _size); Result RunExecutable(int* _exit_code, char** _stdout, char** _stderr, const char* executable, ...); Result ReadFileDescriptor(int fd, char** _content); Result WriteFileDescriptor(int fd, const char* content); Result ReadFile(const char* path, char** _content); Result WriteFile(const char* path, const char* content); Result CopyFile(const char* source_path, const char* destination_path);