mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 11:49:17 +01:00
Merge branch 'empty-files' of https://github.com/kreudom/lgogdownloader
This commit is contained in:
commit
417570cd1e
@ -4023,7 +4023,7 @@ void Downloader::processGalaxyDownloadQueue(const std::string& install_path, Con
|
|||||||
if (filesize == item.totalSizeUncompressed)
|
if (filesize == item.totalSizeUncompressed)
|
||||||
{
|
{
|
||||||
// File is same size
|
// File is same size
|
||||||
if (Util::getFileHash(path.string(), RHASH_MD5) == item.md5)
|
if (item.totalSizeUncompressed == 0 || Util::getFileHash(path.string(), RHASH_MD5) == item.md5)
|
||||||
{
|
{
|
||||||
msgQueue.push(Message(path.string() + ": OK", MSGTYPE_SUCCESS, msg_prefix, MSGLEVEL_DEFAULT));
|
msgQueue.push(Message(path.string() + ": OK", MSGTYPE_SUCCESS, msg_prefix, MSGLEVEL_DEFAULT));
|
||||||
continue;
|
continue;
|
||||||
@ -4125,6 +4125,14 @@ void Downloader::processGalaxyDownloadQueue(const std::string& install_path, Con
|
|||||||
|
|
||||||
bool bChunkFailure = false;
|
bool bChunkFailure = false;
|
||||||
std::time_t timestamp = -1;
|
std::time_t timestamp = -1;
|
||||||
|
// Handle empty files
|
||||||
|
if (item.chunks.empty())
|
||||||
|
{
|
||||||
|
// Create empty file
|
||||||
|
std::ofstream ofs(path.string(), std::ofstream::out | std::ofstream::binary);
|
||||||
|
if (ofs)
|
||||||
|
ofs.close();
|
||||||
|
}
|
||||||
for (unsigned int j = start_chunk; j < item.chunks.size(); ++j)
|
for (unsigned int j = start_chunk; j < item.chunks.size(); ++j)
|
||||||
{
|
{
|
||||||
// Refresh Galaxy login if token is expired
|
// Refresh Galaxy login if token is expired
|
||||||
|
@ -258,7 +258,7 @@ std::vector<galaxyDepotItem> galaxyAPI::getDepotItemsVector(const std::string& h
|
|||||||
|
|
||||||
for (unsigned int i = 0; i < json["depot"]["items"].size(); ++i)
|
for (unsigned int i = 0; i < json["depot"]["items"].size(); ++i)
|
||||||
{
|
{
|
||||||
if (!json["depot"]["items"][i]["chunks"].empty())
|
if (json["depot"]["items"][i]["chunks"].isArray())
|
||||||
{
|
{
|
||||||
galaxyDepotItem item;
|
galaxyDepotItem item;
|
||||||
item.totalSizeCompressed = 0;
|
item.totalSizeCompressed = 0;
|
||||||
@ -287,6 +287,8 @@ std::vector<galaxyDepotItem> galaxyAPI::getDepotItemsVector(const std::string& h
|
|||||||
item.md5 = json["depot"]["items"][i]["md5"].asString();
|
item.md5 = json["depot"]["items"][i]["md5"].asString();
|
||||||
else if (json["depot"]["items"][i]["chunks"].size() == 1)
|
else if (json["depot"]["items"][i]["chunks"].size() == 1)
|
||||||
item.md5 = json["depot"]["items"][i]["chunks"][0]["md5"].asString();
|
item.md5 = json["depot"]["items"][i]["chunks"][0]["md5"].asString();
|
||||||
|
else
|
||||||
|
item.md5 = std::string();
|
||||||
|
|
||||||
items.push_back(item);
|
items.push_back(item);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user