MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / download_file_sync

Method download_file_sync

utility/common.cpp:685–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

683}
684
685Error 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
705Error 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() \

Callers

nothing calls this directly

Calls 2

_wget_syncFunction · 0.85
closeMethod · 0.45

Tested by

no test coverage detected