summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugin.cpp11
-rw-r--r--src/util/request.cpp3
2 files changed, 8 insertions, 6 deletions
diff --git a/src/plugin.cpp b/src/plugin.cpp
index ae278e6c..5da33e38 100644
--- a/src/plugin.cpp
+++ b/src/plugin.cpp
@@ -92,6 +92,8 @@ static int loadPlugin(std::string slug) {
}
void pluginInit() {
+
+
// Load core
// This function is defined in core.cpp
Plugin *corePlugin = init();
@@ -146,20 +148,21 @@ static void extractZip(const char *filename, const char *dir) {
zip_file_t *zf = zip_fopen_index(za, i, 0);
if (!zf) goto cleanup;
- int out = open(path, O_RDWR | O_TRUNC | O_CREAT, 0644);
- assert(out != -1);
+ FILE *outFile = fopen(path, "wb");
+ if (!outFile)
+ continue;
while (1) {
char buffer[4096];
int len = zip_fread(zf, buffer, sizeof(buffer));
if (len <= 0)
break;
- write(out, buffer, len);
+ fwrite(buffer, 1, len, outFile);
}
err = zip_fclose(zf);
assert(!err);
- close(out);
+ fclose(outFile);
}
}
diff --git a/src/util/request.cpp b/src/util/request.cpp
index 24e01f49..e25b3df3 100644
--- a/src/util/request.cpp
+++ b/src/util/request.cpp
@@ -84,7 +84,6 @@ json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ) {
printf("Requesting %s\n", url.c_str());
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
CURLcode res = curl_easy_perform(curl);
- printf("%d\n", res);
// Cleanup
if (method != GET_METHOD)
@@ -130,7 +129,7 @@ bool requestDownload(std::string url, std::string filename, float *progress) {
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_VERBOSE, false);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeFileCallback);
+ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, xferInfoCallback);
curl_easy_setopt(curl, CURLOPT_XFERINFODATA, progress);