| 683 | } |
| 684 | |
| 685 | Error gdre::download_file_sync(const String &p_url, const String &output_path, float *p_progress, bool *p_cancelled, int64_t *r_size) { |
| 686 | Error dir_err = ensure_dir(output_path.get_base_dir()); |
| 687 | if (dir_err) { |
| 688 | return dir_err; |
| 689 | } |
| 690 | Ref<FileAccess> fa = FileAccess::open(output_path, FileAccess::WRITE, &dir_err); |
| 691 | if (fa.is_null()) { |
| 692 | return ERR_FILE_CANT_WRITE; |
| 693 | } |
| 694 | |
| 695 | Error download_err = _wget_sync(p_url, fa, 5, {}, p_progress, p_cancelled, r_size); |
| 696 | if (download_err) { |
| 697 | fa->close(); |
| 698 | gdre::rimraf(output_path); |
| 699 | return download_err; |
| 700 | } |
| 701 | fa->close(); |
| 702 | return OK; |
| 703 | } |
| 704 | |
| 705 | Error gdre::wpost_sync(const String &p_url, const Vector<uint8_t> &p_data, const Vector<String> &extra_headers, bool gzip, float *p_progress, bool *p_cancelled) { |
| 706 | #define WPOST_CANCELLED_CHECK() \ |
nothing calls this directly
no test coverage detected