Add the abillity to force upload/download of cloud saves even if up-to-date

This commit is contained in:
loki-47-6F-64 2022-08-04 23:27:04 +02:00
parent 4ff846e5cd
commit 6870330eab
3 changed files with 5 additions and 2 deletions

View File

@ -297,8 +297,10 @@ class Config
Blacklist ignorelist; Blacklist ignorelist;
Blacklist gamehasdlc; Blacklist gamehasdlc;
// Cloud save options
std::vector<std::string> cloudWhiteList; std::vector<std::string> cloudWhiteList;
std::vector<std::string> cloudBlackList; std::vector<std::string> cloudBlackList;
bool bCloudForce;
std::string sGameHasDLCList; std::string sGameHasDLCList;

View File

@ -233,6 +233,7 @@ int main(int argc, char *argv[])
("wine-prefix", bpo::value<std::string>(&Globals::globalConfig.dirConf.sWinePrefix)->default_value("."), "Set wineprefix directory") ("wine-prefix", bpo::value<std::string>(&Globals::globalConfig.dirConf.sWinePrefix)->default_value("."), "Set wineprefix directory")
("cloud-whitelist", bpo::value<std::vector<std::string>>(&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-whitelist", bpo::value<std::vector<std::string>>(&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<std::vector<std::string>>(&Globals::globalConfig.cloudBlackList)->multitoken(), "Exclude this list of cloud saves\n Example: --cloud-blacklist saves/AutoSave-0 saves/AutoSave-1/screenshot.png") ("cloud-blacklist", bpo::value<std::vector<std::string>>(&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<bool>(&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 #ifdef USE_QT_GUI_LOGIN
("enable-login-gui", bpo::value<bool>(&Globals::globalConfig.bEnableLoginGUI)->zero_tokens()->default_value(false), "Enable login GUI when encountering reCAPTCHA on login form") ("enable-login-gui", bpo::value<bool>(&Globals::globalConfig.bEnableLoginGUI)->zero_tokens()->default_value(false), "Enable login GUI when encountering reCAPTCHA on login form")
#endif #endif

View File

@ -4798,7 +4798,7 @@ void Downloader::uploadCloudSavesById(const std::string& product_id, int build_i
cloudSaveFile local_csf { std::move(it->second) }; cloudSaveFile local_csf { std::move(it->second) };
path_to_cloudSaveFile.erase(it); 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); iTotalRemainingBytes.fetch_add(local_csf.fileSize);
dlCloudSaveQueue.push(local_csf); 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 // 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); 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; std::cout << "Already up to date -- skipping: " << csf.path << std::endl;
return; // This file is already completed return; // This file is already completed
} }