From 2a76c4c10ed89310b53f34113891c3e9a4b8c67c Mon Sep 17 00:00:00 2001 From: Markus Date: Mon, 14 Oct 2019 15:16:15 +0200 Subject: [PATCH] change to diferned download urls --- parameterManager.h | 3 ++- programManager.cpp | 15 +++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/parameterManager.h b/parameterManager.h index 86ffae8..a0b0cc8 100644 --- a/parameterManager.h +++ b/parameterManager.h @@ -40,7 +40,8 @@ struct Settings { Settings(std::string name) : name(name) {} const std::string programName = "S_New4"; - const std::string VersionFileUrl = "https://cloud.obermui.de/s/cLRYJQAMqWDFt5g/download"; + const std::string VersionFileUrl = "https://cloud.obermui.de/s/H47Xoqy2czfJzYp/download?path=%2F&files=Version.txt"; + const std::string ProgrammFileUrl = "https://cloud.obermui.de/s/H47Xoqy2czfJzYp/download?path=%2F&files=S_New4"; std::string name, accountFilePath = "/tmp/a", diff --git a/programManager.cpp b/programManager.cpp index d7e074c..4cebe4c 100644 --- a/programManager.cpp +++ b/programManager.cpp @@ -27,7 +27,7 @@ int ProgramManager::start(Settings *settings) return 174; } - settings->modus = UPDATE_MODUS; + //settings->modus = UPDATE_MODUS; switch (settings->modus) { @@ -968,8 +968,6 @@ int ProgramManager::newsModus(Settings *settings) return 0; } -#include - int ProgramManager::updateModus(Settings *settings) { std::cout << "Check newst Version..." << std::endl; @@ -1003,15 +1001,8 @@ int ProgramManager::updateModus(Settings *settings) std::cout << "Lade Dateien herunter..." << std::endl; - std::string downloadUrl; - std::getline(strstream, downloadUrl); - if(downloadUrl.find("/download") == std::string::npos) { - std::cout << " => Error: Gedownloadete Datei hat ungültigen DownloadLink: '" << downloadUrl << "'" << std::endl; - return 3; - } - std::string downloadedFilePath = settings->cacheDir + "NeusteVersion" + ((settings->pathSymbol == '\\') ? ".exe" : ""); - if( pageManager.downLoadToFile(downloadedFilePath, downloadUrl) != 0) { + if( pageManager.downLoadToFile(downloadedFilePath, settings->ProgrammFileUrl) != 0) { if(settings->debugMode) std::cerr << "Download new Version failed" << std::endl; return 3; @@ -1049,7 +1040,7 @@ int ProgramManager::updateModus(Settings *settings) std::cout << "Ersetzte jetzige Version mit neuer Version des Programms..." << std::endl; - if(rename(downloadedFilePath.c_str(), exePath.c_str()) != 0) { + if(rename(downloadedFilePath.c_str(), exePath.c_str() ) != 0) { perror("Mv failed"); return 6; } else {