From 7d7aae7a23adcdac79dbfa5b3c3d972d647dd80b Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 16 Sep 2017 17:39:34 -0400 Subject: [PATCH] Create plugins/ directory if doesn't exist when refresing plugins --- src/plugin.cpp | 3 +-- src/util/request.cpp | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/plugin.cpp b/src/plugin.cpp index 3b4fe487..e35f1b41 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -92,8 +92,6 @@ static int loadPlugin(std::string slug) { } void pluginInit() { - - // Load core // This function is defined in core.cpp Plugin *corePlugin = init(); @@ -242,6 +240,7 @@ static void pluginRefreshPlugin(json_t *pluginJ) { // Download zip std::string filename = "plugins/"; + mkdir(filename.c_str(), 0755); filename += slug; filename += ".zip"; bool success = requestDownload(download, filename, &downloadProgress); diff --git a/src/util/request.cpp b/src/util/request.cpp index 5693f368..90d88e83 100644 --- a/src/util/request.cpp +++ b/src/util/request.cpp @@ -103,11 +103,6 @@ json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ) { } -static size_t writeFileCallback(char *ptr, size_t size, size_t nmemb, void *userdata) { - FILE *file = (FILE*) userdata; - return fwrite(ptr, size, nmemb, file); -} - static int xferInfoCallback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) { float *progress = (float*) clientp; if (progress) {