From 6870330eab28e5917f48e189f7cbf2a41edf2abc Mon Sep 17 00:00:00 2001 From: loki-47-6F-64 Date: Thu, 4 Aug 2022 23:27:04 +0200 Subject: [PATCH] Add the abillity to force upload/download of cloud saves even if up-to-date --- include/config.h | 2 ++ main.cpp | 1 + src/downloader.cpp | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/config.h b/include/config.h index f97f07a..a421f57 100644 --- a/include/config.h +++ b/include/config.h @@ -297,8 +297,10 @@ class Config Blacklist ignorelist; Blacklist gamehasdlc; + // Cloud save options std::vector cloudWhiteList; std::vector cloudBlackList; + bool bCloudForce; std::string sGameHasDLCList; diff --git a/main.cpp b/main.cpp index e153c05..fea712a 100644 --- a/main.cpp +++ b/main.cpp @@ -233,6 +233,7 @@ int main(int argc, char *argv[]) ("wine-prefix", bpo::value(&Globals::globalConfig.dirConf.sWinePrefix)->default_value("."), "Set wineprefix directory") ("cloud-whitelist", bpo::value>(&Globals::globalConfig.cloudWhiteList)->multitoken(), "Include this list of cloud saves, by default all cloud saves are included\n Example: --cloud-whitelist saves/AutoSave-0 saves/AutoSave-1/screenshot.png") ("cloud-blacklist", bpo::value>(&Globals::globalConfig.cloudBlackList)->multitoken(), "Exclude this list of cloud saves\n Example: --cloud-blacklist saves/AutoSave-0 saves/AutoSave-1/screenshot.png") + ("cloud-force", bpo::value(&Globals::globalConfig.bCloudForce)->zero_tokens()->default_value(false), "Download or Upload cloud saves even if they're up-to-date\nDelete remote cloud saves even if no saves are whitelisted") #ifdef USE_QT_GUI_LOGIN ("enable-login-gui", bpo::value(&Globals::globalConfig.bEnableLoginGUI)->zero_tokens()->default_value(false), "Enable login GUI when encountering reCAPTCHA on login form") #endif diff --git a/src/downloader.cpp b/src/downloader.cpp index 5588b53..20f9573 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -4798,7 +4798,7 @@ void Downloader::uploadCloudSavesById(const std::string& product_id, int build_i cloudSaveFile local_csf { std::move(it->second) }; path_to_cloudSaveFile.erase(it); - if(csf.lastModified < local_csf.lastModified) { + if(Globals::globalConfig.bCloudForce || csf.lastModified < local_csf.lastModified) { iTotalRemainingBytes.fetch_add(local_csf.fileSize); dlCloudSaveQueue.push(local_csf); @@ -4850,7 +4850,7 @@ void Downloader::downloadCloudSavesById(const std::string& product_id, int build // last_write_time minus a single second, since time_t is only accurate to the second unlike boost::posix_time::ptime auto time = boost::posix_time::from_time_t(boost::filesystem::last_write_time(filepath) - 1); - if(time <= csf.lastModified) { + if(!Globals::globalConfig.bCloudForce && time <= csf.lastModified) { std::cout << "Already up to date -- skipping: " << csf.path << std::endl; return; // This file is already completed }