Skip to content

Commit a88175b

Browse files
committed
Trying to fix by renaming utils to download
1 parent 10c0d82 commit a88175b

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

core/include/constants.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#pragma once
12
#define ROOT_PATH "/"
23

34
#define NRO_PATH_1 "/switch/Calculator_NX.nro" // This is for if the user manually got this app from my GitHub

core/include/utils.hpp renamed to core/include/download.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#pragma once
2+
13
#include <json.hpp>
24
#include <sys/select.h>
35
#include <curl/curl.h>
@@ -13,6 +15,7 @@
1315
#define API_AGENT "EmreTech"
1416
using json = nlohmann::json;
1517

18+
size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
1619
void downloadFile(const char *url, const char *filename);
1720
std::string getLatestTag(std::string url);
1821
std::string getLatestDownload(std::string url);

core/source/utils.cpp renamed to core/source/download.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
#include "utils.hpp"
1+
#include "download.hpp"
2+
3+
size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) {
4+
size_t written = fwrite(ptr, size, nmemb, stream);
5+
return written;
6+
}
27

38
void downloadFile(const char *url, const char *filename) {
49
CURL *curl;
@@ -16,7 +21,7 @@ void downloadFile(const char *url, const char *filename) {
1621
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
1722
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
1823

19-
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
24+
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
2025
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
2126

2227
res = curl_easy_perform(curl);

gui/source/gui_app.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <filesystem>
44
#include <fstream>
55
#include "constants.hpp"
6-
#include "utils.hpp"
6+
#include "download.hpp"
77
//#include "app.hpp"
88

99
using namespace brls::literals;

gui/source/updaterTab.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "updaterTab.hpp"
22

3-
#include "utils.hpp"
3+
#include "download.hpp"
44
#include "constants.hpp"
55
#include <string>
66
#include <filesystem>

0 commit comments

Comments
 (0)