change to diferned download urls

This commit is contained in:
Markus 2019-10-14 15:16:15 +02:00
parent 27b33bfad4
commit 2a76c4c10e
2 changed files with 5 additions and 13 deletions

View File

@ -40,7 +40,8 @@ struct Settings {
Settings(std::string name) : name(name) {} Settings(std::string name) : name(name) {}


const std::string programName = "S_New4"; 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, std::string name,
accountFilePath = "/tmp/a", accountFilePath = "/tmp/a",

View File

@ -27,7 +27,7 @@ int ProgramManager::start(Settings *settings)
return 174; return 174;
} }


settings->modus = UPDATE_MODUS; //settings->modus = UPDATE_MODUS;




switch (settings->modus) { switch (settings->modus) {
@ -968,8 +968,6 @@ int ProgramManager::newsModus(Settings *settings)
return 0; return 0;
} }


#include <zip.h>

int ProgramManager::updateModus(Settings *settings) int ProgramManager::updateModus(Settings *settings)
{ {
std::cout << "Check newst Version..." << std::endl; std::cout << "Check newst Version..." << std::endl;
@ -1003,15 +1001,8 @@ int ProgramManager::updateModus(Settings *settings)


std::cout << "Lade Dateien herunter..." << std::endl; 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" : ""); 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) if(settings->debugMode)
std::cerr << "Download new Version failed" << std::endl; std::cerr << "Download new Version failed" << std::endl;
return 3; return 3;
@ -1049,7 +1040,7 @@ int ProgramManager::updateModus(Settings *settings)


std::cout << "Ersetzte jetzige Version mit neuer Version des Programms..." << std::endl; 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"); perror("Mv failed");
return 6; return 6;
} else { } else {