throw a EExists error when calling emscripten_wget twice with the same name
i dont know how to deal with this situation, but the api reference says that the file would be overwriten.
the following is simple piece of the code which is much like the official one.
#include <stdio.h> #include <ctype.h> #include <string.h> #include <assert.h> #include <stdlib.h> #include <emscripten.h>
int main() { const char * file = "./test.txt"; unsigned char* buffer; emscripten_wget(file , file); emscripten_wget(file , file);
FILE * f = fopen(file, "r");
fseek(f, 0, SEEK_END);
int size = ftell(f);
printf("size: %d\n", size);
buffer = (unsigned char*)malloc(sizeof(unsigned char) * (size+1));
rewind(f);
fread(buffer, 1, size, f);
fclose(f);
buffer[size] = 0;
int result = 0;
printf("%s\n", buffer);
return 0;
}
https://github.com/kripken/emscripten/pull/4617
What options did you compile that with?
emcc text_wget.cpp -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s ASSERTIONS=1 -s EMTERPRETIFY_FILE=emtepret.bin -O2 -g2 -o text_wget.html
I don't think it is necessary to throw a error in that case which a warn would generally happened. However, according to #4617 , there is no need to open this issue further.