| 94 | } |
| 95 | |
| 96 | int main() { |
| 97 | emscripten_async_wget( |
| 98 | "/this_is_not_a_file", |
| 99 | "/tmp/null", |
| 100 | onLoaded, |
| 101 | onError); |
| 102 | |
| 103 | emscripten_async_wget( |
| 104 | "/test.html", |
| 105 | "/tmp/test.html", |
| 106 | onLoaded, |
| 107 | onError); |
| 108 | |
| 109 | // Try downloading the same file a second time |
| 110 | emscripten_async_wget( |
| 111 | "/test.html", |
| 112 | "/tmp/test.html", |
| 113 | onLoaded, |
| 114 | onError); |
| 115 | |
| 116 | // Try downloading a file to a destination directory that does not exist. |
| 117 | emscripten_async_wget( |
| 118 | "/test.html", |
| 119 | "/this_directory_does_not_exist_and_should_be_created_by_wget/test.html", |
| 120 | onLoaded, |
| 121 | onError); |
| 122 | |
| 123 | mkdir("/path", 0777); |
| 124 | chdir("/path"); |
| 125 | |
| 126 | // Try downloading a file to a destination directory that is a nonexisting path relative to CWD. |
| 127 | emscripten_async_wget( |
| 128 | "/test.html", |
| 129 | "this_directory_is_relative_to_cwd/test.html", |
| 130 | onLoaded, |
| 131 | onError); |
| 132 | |
| 133 | char name[40]; |
| 134 | strcpy(name, "/tmp/screen_shot.png"); // test for issue #2349, name being free'd |
| 135 | emscripten_async_wget( |
| 136 | "/screenshot.png", |
| 137 | name, |
| 138 | onLoaded, |
| 139 | onError); |
| 140 | memset(name, 0, 30); |
| 141 | |
| 142 | emscripten_set_main_loop(wait_wgets, 0, 0); |
| 143 | |
| 144 | return 99; |
| 145 | } |