Skip to content

Commit

Permalink
p6
Browse files Browse the repository at this point in the history
  • Loading branch information
nixxoq committed May 13, 2024
1 parent 1346a01 commit 2dd9daa
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build-release-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
path: |
build\Debug\xp-apps.exe
build\Debug\cpr.dll
build\Debug\libcurl.dll
build\Debug\libcurl-d.dll
build\Debug\zlib.dll
build_debug_x64:
Expand All @@ -54,13 +54,18 @@ jobs:
path: |
build\Debug\xp-apps.exe
build\Debug\cpr.dll
build\Debug\libcurl.dll
build\Debug\libcurl-d.dll
build\Debug\zlib.dll
build_release_x86:
runs-on: windows-2019
steps:
- uses: actions/checkout@v4

- uses: microsoft/setup-msbuild@v2
with:
vs-version: '14.0'
msbuild-architecture: x86

# - run: dir "C:\Program Files"

Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ int main(int argc, char **argv)
// }

curl_global_init(CURL_GLOBAL_DEFAULT);
// getFile("https://raw.githubusercontent.com/Snaky1a/xp-apps/development/upd.json");
getFile("https://raw.githubusercontent.com/Snaky1a/xp-apps/development/upd.json");

if (!checkFlags(argc, argv))
{
Expand Down
44 changes: 22 additions & 22 deletions source/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ static size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp)
return size * nmemb;
}

// void getFile(std::string url)
// {
// CURL *curl = curl_easy_init();
// if (curl)
// {
// CURLcode res;
// curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
// curl_easy_setopt(curl, CURLOPT_URL, url.c_str());

// std::string response;

// curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
// curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
// res = curl_easy_perform(curl);
// if (res != 0)
// {
// fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
// }
// curl_easy_cleanup(curl);
// std::cout << response << std::endl;
// }
// }
void getFile(std::string url)
{
CURL *curl = curl_easy_init();
if (curl)
{
CURLcode res;
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());

std::string response;

curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
res = curl_easy_perform(curl);
if (res != 0)
{
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
}
curl_easy_cleanup(curl);
std::cout << response << std::endl;
}
}

int checkFlags(int argc, char **argv)
{
Expand Down

0 comments on commit 2dd9daa

Please sign in to comment.