emscripten Humble Cloud interface
Edward Rudd
2014-08-20 5d19454921edad7c4c6e4d54da23d62c8193fe2c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
 
#include <emscripten/emscripten.h>
 
#include "humble_cloud.h"
 
#include <dirent.h>
 
extern "C" {
    void test_list_files();
}
 
std::string userDataPath = "/user_data";
std::string userCloudPath = "/user_cloud";
 
void list_folder(const std::string& folder)
{
    std::cout << "Listing files in " << folder << "\n";
 
    DIR *d = opendir(folder.c_str());
    if (d)
    {
        struct dirent *entry = NULL;
        while((entry = readdir(d)))
        {
            if (entry->d_name[0] == '.') continue;
            std::cout << entry->d_name << "\n";
        }
        closedir(d);
    }
}
 
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_cloud_init();
 
    return 0;
}