diff --git a/parameterManager.cpp b/parameterManager.cpp index d261cf8..875fd3b 100644 --- a/parameterManager.cpp +++ b/parameterManager.cpp @@ -743,9 +743,8 @@ void unterOption_clean(Settings * settings, int argc, char **argv) if(remove(settings->cookieFilePath.c_str()) != 0) { std::cout << "Das löschen von " << settings->cookieFilePath << " ist fehlgeschlagen: " << errno << std::endl; return; - } else { + } else count++; - } } for (unsigned i = 0; i < UINT_MAX && fileExists(settings->cookieFilePath + std::to_string(i)); i++) { diff --git a/programManager.cpp b/programManager.cpp index 03ac582..1b8ce9b 100644 --- a/programManager.cpp +++ b/programManager.cpp @@ -19,8 +19,13 @@ ProgramManager::~ProgramManager() int ProgramManager::start(Settings *settings) { pageManager.setProxy(settings->proxy_ip, settings->proxy_port); - pageManager.setCookieFilePath(settings->cookieFilePath); pageManager.setDebugMode(settings->debugMode); + pageManager.setCookieFilePath(settings->cookieFilePath); + if(dirExists(settings->cookieFilePath)) { + std::cout << " => Error: Kann Cokkie-File nicht erstellen: Es existiert bereits ein Ordner mit diesem Namen: \n '" + << settings->cookieFilePath << "'." << std::endl; + return 174; + } switch (settings->modus) { case Modus::DEFAULT_MODUS: @@ -42,8 +47,8 @@ void * threadFunction(void * KA) { myka->exitState=0; - - Reply tmp_reply = myka->pageManager->getServerRequest(myka->pageManager->UrlPraefix + myka->nameInUrl + "/staffel-" + std::to_string(myka->staffel) + "/episode-" + std::to_string(myka->folge)); + Reply tmp_reply = myka->pageManager->getServerRequest(myka->pageManager->UrlPraefix + myka->nameInUrl + + "/staffel-" + std::to_string(myka->staffel) + "/episode-" + std::to_string(myka->folge)); if(tmp_reply.html == "-1") return myka->setState(10); std::string allLinks = myka->pageManager->getLinks(tmp_reply.html); @@ -168,6 +173,11 @@ int ProgramManager::defaultModus(Settings *settings) if(settings->maxThreads > 0) { for (unsigned i = 0; i < settings->maxThreads; ++i) { + if(dirExists(settings->cookieFilePath + std::to_string( i ))) { + std::cout << " => Error: Kann Cokkie-File nicht erstellen: Es existiert bereits ein Ordner mit diesem Namen: \n '" + << settings->cookieFilePath + std::to_string( i ) << "'." << std::endl; + return 174; + } PageManager * pm = new PageManager("socks5://" + settings->proxy_ip + ":" + std::to_string(settings->proxy_port), settings->cookieFilePath + std::to_string( i )); pm->setDebugMode(settings->debugMode);