// File: testrealpath.c #include <stdlib.h> #include <stdio.h> #include <errno.h> int testrealpath(const char* path) { errno = 0; char *t_realpath_buf = realpath(path, NULL); if (NULL == t_realpath_buf) { printf("Resolved failed: \"%s\"\n",path);fflush(stdout); perror("Resolve failed"); return 1; } else { printf("Resolved: \"%s\"\n", t_realpath_buf);fflush(stdout); free(t_realpath_buf); return 0; } }
int main(int argc, char **argv) { // files: testrealpath("testfile.txt"); testrealpath("Folder/testfile.txt"); testrealpath("testnonexistentfile.txt"); // folders testrealpath("Folder"); testrealpath("/Folder"); testrealpath("./"); testrealpath(""); testrealpath("/"); return 0; } /* How to perform the test: 1) Put in a single folder this file (testrealpath.c), a blank file (testfile.txt), a folder (Folder), and inside it another blank file (Folder/testfile.txt) 2) Compile the test, from the starting folder, with: emcc -o testrealpath.html testrealpath.c --preload-file testfile.txt --preload-file Folder 3) Run it with: firefox testrealpath.html Here are the results (emsdk 1.35.7): Resolved: "/testfile.txt" Resolved: "/Folder/testfile.txt" Resolved failed: "testnonexistentfile.txt" Resolved failed: "Folder" Resolved failed: "/Folder" Resolved failed: "./" Resolved failed: "" Resolved failed: "/" So every folder fails the test. What was the result with emsdk 1.34.1 ? Well, do not ask me to reinstall it please! Anyway I'm pretty sure that, at least, "./" or "" returned "/". That's all I can contribute. */ -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.