add printing info text from downloadet file && commits in functions

This commit is contained in:
Markus 2019-10-14 18:34:14 +02:00
parent f9dce0a911
commit 9e2db246fd
2 changed files with 15 additions and 1 deletions

View File

@ -61,7 +61,7 @@ struct Settings {
proxy_ip = "127.0.0.1",
languages = "GerDub,GerSub,Eng",
genaueHoster = "",
version = "3.2.3",
version = "3.2.4",
defaultFileVersion="1.6",
outputFilePath = "",
default_checkPath = "",

View File

@ -983,6 +983,7 @@ int ProgramManager::updateModus(Settings *settings)

// Get newst Version
std::stringstream strstream(html+ "\n");
html.clear();
std::string neusteVersion;
std::getline(strstream, neusteVersion);
if( !isNumber( (pageManager.replace(neusteVersion, ".", "")) ) ) {
@ -992,11 +993,21 @@ int ProgramManager::updateModus(Settings *settings)

std::cout << " => INFO: Jetzige Version: '" << settings->version << "' - Neueste Version: '" << neusteVersion << "'" << std::endl;

//Print INFOs
std::cout << " => Infos (zur Version): " << std::endl;
std::string line;
while (std::getline(strstream, line).good()) {
std::cout << " > " << line << std::endl;
}


//Vergleiche Versionen:
if( atoi(pageManager.replace(neusteVersion, ".", "").c_str()) <= atoi(pageManager.replace(settings->version, ".", "").c_str()) ) {
std::cout << " => Du benützt bereits die neuste Release-Version." << std::endl;
return 0;
}

//Download new Version of Program
std::cout << " => INFO: Lade neue Version herunter..." << std::endl;

std::string downloadedFilePath = settings->cacheDir + "NeusteVersion" + ((settings->pathSymbol == '\\') ? ".exe" : "");
@ -1006,6 +1017,7 @@ int ProgramManager::updateModus(Settings *settings)
}


//Make ist executable for test execution
#ifdef __linux__
std::cout << " => INFO: Mache das Programm ausführbar..." << std::endl;
if(chmod(downloadedFilePath.c_str(), S_IRWXU) != 0) {
@ -1014,6 +1026,7 @@ int ProgramManager::updateModus(Settings *settings)
}
#endif

//Führe neue Version aus und überprüfe rückgabewert
std::cout << " => INFO: Überprüfe die Funktionalität der neuen Version..." << std::endl;

if( system((downloadedFilePath + " --version" ).c_str()) != 0) {
@ -1021,6 +1034,7 @@ int ProgramManager::updateModus(Settings *settings)
return 5;
}

//ersezte alte version mit neuer
std::string exePath = pageManager.getExePath();
if(exePath == "") {
std::cout << " => Error: Function getExepath() ist fehlgeschlagen." << std::endl;