Skip to content

Commit 7239e99

Browse files
committed
[ADD] : add support of EMSCRIPTEN. thanks to @truedim (#44]
1 parent dec011c commit 7239e99

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

ImGuiFileDialog.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ SOFTWARE.
4040
#include <sys/stat.h>
4141
#include <stdio.h>
4242
#include <errno.h>
43+
#if defined (__EMSCRIPTEN__) // EMSCRIPTEN
44+
#include <emscripten.h>
45+
#endif // EMSCRIPTEN
4346
#if defined(__WIN32__) || defined(_WIN32)
4447
#ifndef WIN32
4548
#define WIN32
@@ -52,7 +55,7 @@ SOFTWARE.
5255
#ifndef PATH_MAX
5356
#define PATH_MAX 260
5457
#endif // PATH_MAX
55-
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
58+
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined (__EMSCRIPTEN__)
5659
#define UNIX
5760
#define stricmp strcasecmp
5861
#include <sys/types.h>
@@ -328,6 +331,9 @@ namespace IGFD
328331

329332
#ifdef WIN32
330333
CreateDirectoryA(name.c_str(), nullptr);
334+
#elif defined(__EMSCRIPTEN__)
335+
std::string str = std::string("FS.mkdir('") + name.c_str() + "');";
336+
emscripten_run_script(str.c_str());
331337
#elif defined(UNIX)
332338
char buffer[PATH_MAX] = {};
333339
snprintf(buffer, PATH_MAX, "mkdir -p %s", name.c_str());

0 commit comments

Comments
 (0)