| | |
| | | #include "humble_api.h" |
| | | |
| | | #include <dirent.h> |
| | | #include <sys/stat.h> |
| | | |
| | | extern "C" { |
| | | void test_list_files(); |
| | |
| | | if ((entry->d_type & DT_DIR)>0) { |
| | | list_subfolder(folder + '/' + entry->d_name, entry->d_name, prefix + " "); |
| | | } else { |
| | | std::cout << prefix << " " << entry->d_name << "\n"; |
| | | struct stat st; |
| | | stat((folder + '/' + entry->d_name).c_str(), &st); |
| | | std::cout << prefix << " " << entry->d_name << " S:" << st.st_size << "\n"; |
| | | } |
| | | } |
| | | closedir(d); |
| | |
| | | list_subfolder(folder, folder); |
| | | } |
| | | |
| | | void test_list_files() |
| | | void EMSCRIPTEN_KEEPALIVE test_list_files() |
| | | { |
| | | std::cout << "Listing files\n" ; |
| | | list_folder(userDataPath); |
| | |
| | | std::cout << "File fetch failed\n"; |
| | | } |
| | | |
| | | void test_async_fetch(const char* url) |
| | | void EMSCRIPTEN_KEEPALIVE test_async_fetch(const char* url) |
| | | { |
| | | std::cout << "Fetch file: " << url << "\n"; |
| | | humble_fetch_asset_data(url, NULL, on_get_file, on_fail_file); |
| | | } |
| | | |
| | | void test_demo_end() |
| | | void EMSCRIPTEN_KEEPALIVE test_demo_end() |
| | | { |
| | | std::cout << "Demo has ended\n"; |
| | | humble_demo_ended(); |