forked from markus/S_New4
add printing info text from downloadet file && commits in functions
This commit is contained in:
parent
f9dce0a911
commit
9e2db246fd
@ -61,7 +61,7 @@ struct Settings {
|
|||||||
proxy_ip = "127.0.0.1",
|
proxy_ip = "127.0.0.1",
|
||||||
languages = "GerDub,GerSub,Eng",
|
languages = "GerDub,GerSub,Eng",
|
||||||
genaueHoster = "",
|
genaueHoster = "",
|
||||||
version = "3.2.3",
|
version = "3.2.4",
|
||||||
defaultFileVersion="1.6",
|
defaultFileVersion="1.6",
|
||||||
outputFilePath = "",
|
outputFilePath = "",
|
||||||
default_checkPath = "",
|
default_checkPath = "",
|
||||||
|
@ -983,6 +983,7 @@ int ProgramManager::updateModus(Settings *settings)
|
|||||||
|
|
||||||
// Get newst Version
|
// Get newst Version
|
||||||
std::stringstream strstream(html+ "\n");
|
std::stringstream strstream(html+ "\n");
|
||||||
|
html.clear();
|
||||||
std::string neusteVersion;
|
std::string neusteVersion;
|
||||||
std::getline(strstream, neusteVersion);
|
std::getline(strstream, neusteVersion);
|
||||||
if( !isNumber( (pageManager.replace(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;
|
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()) ) {
|
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;
|
std::cout << " => Du benützt bereits die neuste Release-Version." << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Download new Version of Program
|
||||||
std::cout << " => INFO: Lade neue Version herunter..." << std::endl;
|
std::cout << " => INFO: Lade neue Version herunter..." << std::endl;
|
||||||
|
|
||||||
std::string downloadedFilePath = settings->cacheDir + "NeusteVersion" + ((settings->pathSymbol == '\\') ? ".exe" : "");
|
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__
|
#ifdef __linux__
|
||||||
std::cout << " => INFO: Mache das Programm ausführbar..." << std::endl;
|
std::cout << " => INFO: Mache das Programm ausführbar..." << std::endl;
|
||||||
if(chmod(downloadedFilePath.c_str(), S_IRWXU) != 0) {
|
if(chmod(downloadedFilePath.c_str(), S_IRWXU) != 0) {
|
||||||
@ -1014,6 +1026,7 @@ int ProgramManager::updateModus(Settings *settings)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//Führe neue Version aus und überprüfe rückgabewert
|
||||||
std::cout << " => INFO: Überprüfe die Funktionalität der neuen Version..." << std::endl;
|
std::cout << " => INFO: Überprüfe die Funktionalität der neuen Version..." << std::endl;
|
||||||
|
|
||||||
if( system((downloadedFilePath + " --version" ).c_str()) != 0) {
|
if( system((downloadedFilePath + " --version" ).c_str()) != 0) {
|
||||||
@ -1021,6 +1034,7 @@ int ProgramManager::updateModus(Settings *settings)
|
|||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ersezte alte version mit neuer
|
||||||
std::string exePath = pageManager.getExePath();
|
std::string exePath = pageManager.getExePath();
|
||||||
if(exePath == "") {
|
if(exePath == "") {
|
||||||
std::cout << " => Error: Function getExepath() ist fehlgeschlagen." << std::endl;
|
std::cout << " => Error: Function getExepath() ist fehlgeschlagen." << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user