Browse Source

Create plugins/ directory if doesn't exist when refresing plugins

tags/v0.3.2
Andrew Belt 7 years ago
parent
commit
7d7aae7a23
2 changed files with 1 additions and 7 deletions
  1. +1
    -2
      src/plugin.cpp
  2. +0
    -5
      src/util/request.cpp

+ 1
- 2
src/plugin.cpp View File

@@ -92,8 +92,6 @@ static int loadPlugin(std::string slug) {
} }


void pluginInit() { void pluginInit() {


// Load core // Load core
// This function is defined in core.cpp // This function is defined in core.cpp
Plugin *corePlugin = init(); Plugin *corePlugin = init();
@@ -242,6 +240,7 @@ static void pluginRefreshPlugin(json_t *pluginJ) {


// Download zip // Download zip
std::string filename = "plugins/"; std::string filename = "plugins/";
mkdir(filename.c_str(), 0755);
filename += slug; filename += slug;
filename += ".zip"; filename += ".zip";
bool success = requestDownload(download, filename, &downloadProgress); bool success = requestDownload(download, filename, &downloadProgress);


+ 0
- 5
src/util/request.cpp View File

@@ -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) { 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; float *progress = (float*) clientp;
if (progress) { if (progress) {


Loading…
Cancel
Save