-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Description
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.19 (a5f7b1c)
clang version 16.0.0 (https://github.com/llvm/llvm-project 30171e76f0e5ea8037bc4d1450dd3e12af4d9938)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/rich/source/emsdk/upstream/bin
Building this c program:
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
int main(int argc, char *argv[])
{
struct dirent *pDirent;
DIR *pDir;
// Ensure correct argument count.
if (argc != 2)
{
printf("Usage: main <dirname>\n");
return 1;
}
// Ensure we can open directory.
pDir = opendir(argv[1]);
if (pDir == NULL)
{
char error_buf[300] = {0};
strcpy(error_buf, strerror(errno));
printf("Cannot open directory '%s' with '%s'\n", argv[1], error_buf);
return 1;
}
// Process each entry.
while ((pDirent = readdir(pDir)) != NULL)
{
printf("[%s]\n", pDirent->d_name);
}
// Close directory and exit.
closedir(pDir);
return 0;
}
With -s NODERAWFS
should generate a portable js/wasm combination.
It works fine on linux.
When I run this outputted wasm using node on windows, I get this:
PS C:\Users\aku91\source\repos\debugpyweb> node ..\opendir_c\open_dir_c\main.js C:\Users\aku91\source\repos
Cannot open directory 'C:\Users\aku91\source\repos' with 'No such file or directory'
Debugging the js, I think the problem is here:
emscripten/src/library_path.js
Line 9 in ae13a11
isAbs: (path) => path.charAt(0) === '/', |
Path.isabs
assumes all absolute paths start with '/', which wouldn't work for windows.
Metadata
Metadata
Assignees
Labels
No labels