Skip to content
Permalink
Browse files

Merge branch 'devel' of https://github.com/Turupawn/modioSDK into devel

  • Loading branch information
Turupawn committed Nov 13, 2019
2 parents c9f6e68 + f89246d commit ae97358b271eee22a6f98b51fad48f6a738a6848
Showing with 18 additions and 0 deletions.
  1. +2 −0 include/wrappers/CurlUtility.h
  2. +12 −0 src/wrappers/CurlCallbacks.cpp
  3. +4 −0 src/wrappers/CurlWrapper.cpp
@@ -87,6 +87,8 @@ class CurrentModfileUpload
CURL *curl_handle;
struct curl_slist *slist;
struct curl_httppost *httppost;
bool is_temporary_zip_modfile;
std::string zip_modfile_path;

CurrentModfileUpload();
~CurrentModfileUpload();
@@ -129,8 +129,15 @@ void onModfileUploadFinished(CURL *curl)

if (g_current_modfile_upload->queued_modfile_upload->state == MODIO_MOD_UPLOADING)
{
if(g_current_modfile_upload->is_temporary_zip_modfile)
{
writeLogLine("Deleting temporary modfile " + g_current_modfile_upload->zip_modfile_path, MODIO_DEBUGLEVEL_LOG);
modio::removeFile(g_current_modfile_upload->zip_modfile_path);
}

if (modio::upload_callback)
{
writeLogLine("Triggering upload callback listener", MODIO_DEBUGLEVEL_LOG);
modio::upload_callback(response_code, g_current_modfile_upload->queued_modfile_upload->mod_id);
}

@@ -142,7 +149,12 @@ void onModfileUploadFinished(CURL *curl)

updateModUploadQueueFile();
uploadNextQueuedModfile();
}else
{
writeLogLine("Unhandled error the upload that just finished has the wrong flag: " + modio::toString(g_current_modfile_upload->queued_modfile_upload->state), MODIO_DEBUGLEVEL_ERROR);
}

writeLogLine("Finished handling the modfile upload termination.", MODIO_DEBUGLEVEL_LOG);
updateModUploadQueueFile();
}
} // namespace curlwrapper
@@ -546,6 +546,7 @@ void uploadModfile(QueuedModfileUpload *queued_modfile_upload)
std::string modfile_path = queued_modfile_upload->modfile_creator.getModioModfileCreator()->path;

std::string modfile_zip_path = "";
bool is_temporary_zip_modfile = true;

writeLogLine("Uploading mod: " + toString(queued_modfile_upload->mod_id) + " located at path: " + queued_modfile_upload->path, MODIO_DEBUGLEVEL_LOG);

@@ -559,6 +560,7 @@ void uploadModfile(QueuedModfileUpload *queued_modfile_upload)
{
writeLogLine("Zip file detected: " + modfile_path, MODIO_DEBUGLEVEL_LOG);
modfile_zip_path = modfile_path;
is_temporary_zip_modfile = false;
}else if(modio::fileExists(modfile_path))
{
writeLogLine("File detected " + modfile_path, MODIO_DEBUGLEVEL_LOG);
@@ -621,6 +623,8 @@ void uploadModfile(QueuedModfileUpload *queued_modfile_upload)

queued_modfile_upload->state = MODIO_MOD_STARTING_UPLOAD;
g_current_modfile_upload->curl_handle = curl;
g_current_modfile_upload->is_temporary_zip_modfile = is_temporary_zip_modfile;
g_current_modfile_upload->zip_modfile_path = modfile_zip_path;
g_current_modfile_upload->queued_modfile_upload = queued_modfile_upload;

for (u32 i = 0; i < modio::getHeaders().size(); i++)

0 comments on commit ae97358

Please sign in to comment.
You can’t perform that action at this time.