Wait, I just discovered something else. Forget about the last email. The problem is that whatever file the emscripten-generated code tries to load, becomes a zero-sized file. That's why any files named "data/*" were being set to zero-size, because my code was loading them. Any files that are in that directory but my code isn't loading have the correct size.
So, current hypothesis: *after the emscripten-generated code tries to load a file, it becomes zero-sized* Any ideas? On Friday, June 19, 2015 at 7:21:09 AM UTC+2, Jon Valdés wrote: > > Hi jj, > > On Thursday, June 18, 2015 at 11:40:04 PM UTC+2, jj wrote: >> >> Does --preload-file data/ work? I wonder if this might be about directory >> handling in --embed-file, or the quotes there, or the lack of trailing /, >> or something other similar in command line parsing that ends up creating >> zero-sized files. >> > > Ok, I've been trying stuff along those lines, and I've gotten to a very > weird conclusion:* this happens only if the target dir in the emscripten > FS is "/data"*. If I change the name to anything else, it works. > > For example, all these give me zero-sized files: > em++ -std=c++11 main.cpp -o main.html --embed-file "data" > em++ -std=c++11 main.cpp -o main.html --embed-file "data@data" > em++ -std=c++11 main.cpp -o main.html --embed-file "data@/data" > em++ -std=c++11 main.cpp -o main.html --embed-file "data@/data/" > > But all these work correctly: > em++ -std=c++11 main.cpp -o main.html --embed-file "data@data2" > em++ -std=c++11 main.cpp -o main.html --embed-file "data@foo/data" > em++ -std=c++11 main.cpp -o main.html --embed-file "data@data/foo" > > This seems like a pretty specific bug! > I hope there's an easy fix for this. > > Kind regards, > Jon Valdes > > > > >> 2015-06-18 21:52 GMT+03:00 Jon Valdés <[email protected]>: >> >>> Hi there, >>> >>> I'm trying to embed files for the first time, and I'm getting a strange >>> problem: my files are correctly detected by the emscripten VFS, but they >>> are all zero-sized :-\ >>> >>> Here's a screenshot of one file's info (notice the "usedBytes" variable >>> set to 0): >>> >>> >>> <https://lh3.googleusercontent.com/-CI7ENPpcqpI/VYMR7gu3WwI/AAAAAAAAJoM/ru5eeVS12Ts/s1600/caca_2015-06-18_20-39-51.png> >>> >>> >>> This makes my C++ code fail, as when it tries to get the file size (with >>> the usual combination of fseek and ftell) it always returns zero. >>> >>> >>> In my build script I'm calling emscripten with this command: >>> >>> >>> em++ -std=c++11 main.cpp -o main.html --embed-file "data" >>> >>> >>> Also, if it matters, right now I'm on a Windows machine. >>> >>> >>> Any idea what could be the problem? >>> >>> Thanks a lot in advance! >>> >>> >>> Kind regards, >>> >>> Jon Valdes >>> >>> -- >>> 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 [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
