#include <iostream>
|
|
#include <emscripten/emscripten.h>
|
|
#include "humble_api.h"
|
|
#include <dirent.h>
|
|
extern "C" {
|
void test_list_files();
|
}
|
|
std::string userDataPath = "/user_data";
|
std::string userCloudPath = "/user_cloud";
|
|
void list_subfolder(const std::string& folder, const std::string& short_folder, const std::string& prefix = "")
|
{
|
std::cout << prefix << short_folder << "/\n";
|
|
DIR *d = opendir(folder.c_str());
|
if (d)
|
{
|
struct dirent *entry = NULL;
|
while((entry = readdir(d)))
|
{
|
if (entry->d_name[0] == '.') continue;
|
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";
|
}
|
}
|
closedir(d);
|
}
|
}
|
|
void list_folder(const std::string& folder)
|
{
|
std::cout << "Listing files\n";
|
list_subfolder(folder, folder);
|
}
|
|
void test_list_files()
|
{
|
list_folder(userDataPath);
|
list_folder(userCloudPath);
|
}
|
|
int main(int argc, char * argv[])
|
{
|
std::cout << "Welcome Main\n";
|
// call dummy function to init cloud
|
humble_init();
|
|
// Test humble_get_url_for_asset
|
|
char * path = humble_get_url_for_asset("textures/icon1.png");
|
std::cout << "humble_get_url_for_asset returned " << path << "\n";
|
free(path);
|
|
return 0;
|
}
|