| CMakeLists.txt | ●●●●● patch | view | raw | blame | history | |
| humble_cloud.h | ●●●●● patch | view | raw | blame | history | |
| humble_cloud.js | ●●●●● patch | view | raw | blame | history | |
| main.cpp | ●●●●● patch | view | raw | blame | history |
CMakeLists.txt
@@ -7,6 +7,9 @@ CreateProgram(TestApp FILES main.cpp ASM_FLAG NO_EXIT_RUNTIME=1 EXPORTED_FUNCTIONS="['_main','_test_list_files']" JS_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/humble_cloud.js ) humble_cloud.h
New file @@ -0,0 +1,14 @@ #ifndef __HUMBLE_CLOUD_H__ #define __HUMBLE_CLOUD_H__ #ifdef __cplusplus extern "C" { #endif bool humble_cloud_init(); #ifdef __cplusplus }; #endif #endif // __HUMBLE_CLOUD_H__ humble_cloud.js
@@ -7,12 +7,13 @@ staticInit: function() { console.log('Humble Cloud Init'); addRunDependency('HUMBLE_CLOUD'); FS.createFolder('/', 'user_data', true, true); console.log('Doing stuff to synchronize files'); removeRunDependency('HUMBLE_CLOUD'); } }, humble_fs_sync: function() { console.log("Hello Syncing"); humble_cloud_init: function() { // Dummy function to pull in the rest of the functions } }; main.cpp
@@ -2,20 +2,36 @@ #include <emscripten/emscripten.h> extern "C" { extern bool humble_fs_sync(); }; #include "humble_cloud.h" #include <dirent.h> extern "C" { void test_list_files(); } std::string userPath = "/user_data"; void test_list_files() { std::cout << "Listing Files\n"; DIR *d = opendir(userPath.c_str()); if (d) { struct dirent *entry = NULL; while((entry = readdir(d))) { std::cout << entry->d_name << "\n"; } closedir(d); } } int main(int argc, char * argv[]) { std::cout << "External JS Test\n"; std::cout << "Calling sync method\n"; humble_fs_sync(); std::cout << "Sync triggered\n"; std::cout << "Welcome Main\n"; // call dummy function to init cloud humble_cloud_init(); return 0; }