aboutsummaryrefslogtreecommitdiffstats
path: root/src/assets.c
diff options
context:
space:
mode:
authorLibravatar bigfoot547 <[email protected]>2024-01-05 04:53:20 -0600
committerLibravatar bigfoot547 <[email protected]>2024-01-05 04:53:20 -0600
commit11672146b9bf67cae05e8e3207c9bd1e47d52220 (patch)
tree4d72fd88efbabeeb37509cdc99c5404528183ca1 /src/assets.c
parentdownloads assets correctly (diff)
extracts natives
Diffstat (limited to 'src/assets.c')
-rw-r--r--src/assets.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/assets.c b/src/assets.c
index 7699d33..695e0ab 100644
--- a/src/assets.c
+++ b/src/assets.c
@@ -28,7 +28,9 @@ struct l2_assets__download_info {
l2_sha1_state_t digest_state;
size_t recv_size;
+#ifndef NDEBUG
char errbuf[CURL_ERROR_SIZE];
+#endif
struct l2_assets__download_info *next;
};
@@ -64,12 +66,14 @@ int l2_assets__download_asset_init(CURL *curl, void *user)
return -1;
}
- CMD_DEBUG("asset url %s", info->url);
-
curl_easy_setopt(curl, CURLOPT_URL, info->url);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, info);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &l2_assets__download_asset_dlcb);
+
+#ifndef NDEBUG
+ memset(&info->errbuf, 0, sizeof(info->errbuf));
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, info->errbuf);
+#endif
return 0;
}
@@ -84,7 +88,9 @@ int l2_assets__download_asset_complete(CURL *curl, CURLcode code, void *user)
if (code != CURLE_OK) {
CMD_WARN("Failed to download asset %s: %s", info->name, curl_easy_strerror(code));
- CMD_DEBUG("Info for %s: %s", info->name, info->errbuf);
+#ifndef NDEBUG
+ CMD_DEBUG("Debug info for %s: %s", info->name, info->errbuf);
+#endif
return -1;
}
@@ -238,6 +244,7 @@ int l2_assets__download_assets(json_t *asset_index, char **path)
res = -1;
goto cleanup;
}
+ CMD_INFO0("Successfully downloaded assets.");
} else {
CMD_INFO0("No assets to download.");
res = 0;
@@ -261,7 +268,6 @@ int l2_assets__download_assets(json_t *asset_index, char **path)
*path = resbasepath;
resbasepath = NULL; /* prevent out variable from being freed */
- CMD_INFO0("Successfully downloaded assets.");
res = 0;
cleanup: