#pragma once class Asset { public: #ifdef __ANDROID__ static void set_android_asset_manager(void* asset_manager); private: static void* m_android_asset_manager; void* m_android_asset = nullptr; public: #endif static std::vector list_files(std::string folder, const std::string& filter_regex); static bool exist(std::string path); static bool delete_file(const std::string& path); static std::string absolute(const std::string& path); static bool is_asset(const std::string& path); static bool create_dir(const std::string& path); bool m_stop_async = false; std::function on_progress; std::future remote_future; std::vector tmp_data; std::string m_current_path; std::string m_current_url; FILE* m_fp = nullptr; int m_len = 0; uint8_t* m_data = nullptr; bool open(const char* path); bool open_url(const std::string& url, std::function progress = nullptr); std::future& open_url_async(const std::string& url, std::function progress = nullptr, std::function complete = nullptr); uint8_t* read_all(); void close(); void close_remote(); ~Asset(); };