Fix compiling on windows and other mistakes

This commit is contained in:
TheKodeToad 2024-06-18 22:01:47 +01:00
parent 586618f1ac
commit 552da59007
No known key found for this signature in database
GPG key ID: 5E39D70B4C93C38E
3 changed files with 7 additions and 7 deletions

View file

@ -15,5 +15,5 @@ add_custom_command(
target_sources(installer PRIVATE resources/resources.cpp resources/resources.h) target_sources(installer PRIVATE resources/resources.cpp resources/resources.h)
target_link_libraries(installer PRIVATE wx::base wx::core wx::net wx::xrc) target_link_libraries(installer PRIVATE wx::base wx::core wx::net wx::xrc)
include_directories(lib/wx/include) include_directories(../lib/wx/include)
include_directories(lib/json/include) include_directories(../lib/json/include)

View file

@ -19,7 +19,7 @@ static LoaderLibrary make_loader_library(const nlohmann::json &json) {
if (name.IsEmpty() || url.IsEmpty() || sha1.IsEmpty() || size < 0) if (name.IsEmpty() || url.IsEmpty() || sha1.IsEmpty() || size < 0)
return {}; return {};
return {.valid = true, .name = std::move(name), .url = std::move(url), .sha1 = std::move(sha1), .size = size}; return {true, std::move(name), std::move(url), std::move(sha1), size};
} }
static LoaderVersion make_loader_version(const nlohmann::json &json) { static LoaderVersion make_loader_version(const nlohmann::json &json) {
@ -50,8 +50,7 @@ static LoaderVersion make_loader_version(const nlohmann::json &json) {
if (version.IsEmpty() || !release_date.IsValid()) if (version.IsEmpty() || !release_date.IsValid())
return {}; return {};
return { return {true, std::move(version), release_date, std::move(libraries)};
.valid = true, .version = std::move(version), .release_date = release_date, .libraries = std::move(libraries)};
} }
void get_loader_version(wxEvtHandler *handler, const wxString &version, void get_loader_version(wxEvtHandler *handler, const wxString &version,
@ -66,7 +65,7 @@ void get_loader_version(wxEvtHandler *handler, const wxString &version,
request.SetHeader("User-Agent", info::USER_AGENT); request.SetHeader("User-Agent", info::USER_AGENT);
handler->Bind(wxEVT_WEBREQUEST_STATE, [callback = std::move(callback)](wxWebRequestEvent &event) mutable { handler->Bind(wxEVT_WEBREQUEST_STATE, [callback = std::move(callback)](const wxWebRequestEvent &event) mutable {
if (event.GetState() == wxWebRequest::State_Completed) { if (event.GetState() == wxWebRequest::State_Completed) {
const nlohmann::json json = nlohmann::json::parse(event.GetResponse().AsString().utf8_string()); const nlohmann::json json = nlohmann::json::parse(event.GetResponse().AsString().utf8_string());
@ -102,7 +101,7 @@ void get_loader_versions(wxEvtHandler *handler,
request.SetHeader("User-Agent", info::USER_AGENT); request.SetHeader("User-Agent", info::USER_AGENT);
handler->Bind(wxEVT_WEBREQUEST_STATE, [callback = std::move(callback)](wxWebRequestEvent &event) mutable { handler->Bind(wxEVT_WEBREQUEST_STATE, [callback = std::move(callback)](const wxWebRequestEvent &event) mutable {
if (event.GetState() == wxWebRequest::State_Completed) { if (event.GetState() == wxWebRequest::State_Completed) {
const nlohmann::json json = nlohmann::json::parse(event.GetResponse().AsString().utf8_string()); const nlohmann::json json = nlohmann::json::parse(event.GetResponse().AsString().utf8_string());

View file

@ -3,6 +3,7 @@
#include <optional> #include <optional>
#include <wx/datetime.h> #include <wx/datetime.h>
#include <wx/event.h> #include <wx/event.h>
#include <cstdint>
struct LoaderLibrary { struct LoaderLibrary {
bool valid; bool valid;