From 763c500c878637bf1687256828094c11e1de6f8a Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 12 Jan 2021 20:41:58 +0100 Subject: [PATCH] fixes + chanche defaults + switch automatily path symbol --- src/parameterManager.cpp | 6 ++++-- src/parameterManager.h | 4 +++- src/programManager.cpp | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/parameterManager.cpp b/src/parameterManager.cpp index f91d94a..3261311 100644 --- a/src/parameterManager.cpp +++ b/src/parameterManager.cpp @@ -9,11 +9,13 @@ int setPaths(Settings &settings) CacheDir = std::string(getenv("HOME")) + "/.cache/S_New4/"; SettingsDir = std::string( getenv("HOME") ) + "/.config/S_New4/"; settings.pathSymbol = '/'; + settings.wrongPathSymbol = '\\'; #endif #ifdef _WIN32 CacheDir = std::string(getenv("LOCALAPPDATA")) + "\\S_New4\\"; // C:\Users\{username}\AppData\Local SettingsDir = std::string( getenv("APPDATA") ) + "\\S_New4\\"; // C:\Users\{username}\AppData\Roaming settings.pathSymbol = '\\'; + settings.wrongPathSymbol = '/'; #endif if(CacheDir == "" || SettingsDir == "") { @@ -196,7 +198,7 @@ int loadDefaulOptions(Settings &settings) ofs << "#" << std::endl << "# -> Einstellungen für default Modus:" << std::endl << "#" << std::endl << std::endl; ofs << "# -> Standart Wert für Parameter: -g, --genaue-hoster:" << std::endl; - ofs << "default_GenaueHoster=Vivo,GoUnlimited" << std::endl << std::endl; + ofs << "default_GenaueHoster=UpStream,Vidoza,Vivo,GoUnlimited" << std::endl << std::endl; ofs << "# -> Standart Wert für Parameter: -l, --languages:" << std::endl; ofs << "#default_Sprachen=GerDub,GerSub,Eng" << std::endl << std::endl; @@ -208,7 +210,7 @@ int loadDefaulOptions(Settings &settings) ofs << "#default_CheckMaxDirs=20" << std::endl << std::endl; ofs << "# -> Standart Wert für Parameter: -t, --threads:" << std::endl; - ofs << "#default_maxThreads=0" << std::endl << std::endl; + ofs << "default_maxThreads=3" << std::endl << std::endl; ofs << "#" << std::endl << "# -> Einstellungen für search Modus:" << std::endl << "#" << std::endl << std::endl; diff --git a/src/parameterManager.h b/src/parameterManager.h index 90d004e..a6203a2 100644 --- a/src/parameterManager.h +++ b/src/parameterManager.h @@ -27,7 +27,7 @@ #define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files=" #define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files=" -#define VERSION "4.3.4" +#define VERSION "4.3.5" @@ -118,6 +118,8 @@ struct Settings { default_maxDirs = 20, updateWarningDays = 10; char pathSymbol = '/'; + char wrongPathSymbol = '\\'; + unsigned maxThreads = 0; }; diff --git a/src/programManager.cpp b/src/programManager.cpp index 1fd147f..591080d 100644 --- a/src/programManager.cpp +++ b/src/programManager.cpp @@ -350,9 +350,16 @@ int ProgramManager::defaultModus(Settings *settings) //Wenn kein Name mit -n Angegeben wurde: if(settings->name == "") { if(settings->default_checkPath != "") { + if(settings->default_checkPath.find(settings->pathSymbol) == std::string::npos && settings->default_checkPath.find(settings->wrongPathSymbol) != std::string::npos ) { + char t = settings->wrongPathSymbol; + settings->wrongPathSymbol = settings->pathSymbol; + settings->pathSymbol = t; + } + if(settings->default_checkPath[settings->default_checkPath.length()-1] == settings->pathSymbol) settings->default_checkPath.pop_back(); size_t pos = settings->default_checkPath.find_last_of(std::string(1, settings->pathSymbol)); + if( pos != std::string::npos) { settings->name = settings->default_checkPath.substr(pos + 1); if(settings->debugMode)