diff --git a/src/reHDD.cpp b/src/reHDD.cpp index 4946859..a273166 100644 --- a/src/reHDD.cpp +++ b/src/reHDD.cpp @@ -344,15 +344,29 @@ void reHDD::searchDrives(list *plistDrives) */ void reHDD::filterIgnoredDrives(list *plistDrives) { - list> vtlIgnoredDevices; // store drives from ignore file - ifstream input("ignoreDrives.conf"); // read ignore file string systemDrivePath; - if (getSystemDrive(systemDrivePath)) { Logger::logThis()->info("Found system drive: " + systemDrivePath); + + list::iterator it; + for (it = plistDrives->begin(); it != plistDrives->end(); ++it) + { + if (it->getPath().find(systemDrivePath) != std::string::npos) // compare found system drive and current drive + { + // system drive found --> ignore this drive +#ifdef LOG_LEVEL_HIGH + Logger::logThis()->info("system drive found --> ignore this drive: " + it->getPath()); +#endif + it = plistDrives->erase(it); + it--; + } + } } + list> vtlIgnoredDevices; // store drives from ignore file + ifstream input("ignoreDrives.conf"); // read ignore file + for (string sLine; getline(input, sLine);) { // Logger::logThis()->info("read uuid: " + sLine); @@ -614,7 +628,6 @@ void reHDD::handleAbort() bool reHDD::getSystemDrive(string &systemDrive) { - Logger::logThis()->info("--> search system drive <--"); char *cLine = NULL; size_t len = 0; bool systemDriveFound = false; @@ -641,6 +654,8 @@ bool reHDD::getSystemDrive(string &systemDrive) if ((cLine[0U] != '|') && (cLine[0U] != '`')) { systemDrive = currentLine; + systemDrive.erase(std::remove(systemDrive.begin(), systemDrive.end(), '\n'), systemDrive.end()); // remove newline + systemDrive.erase(std::remove(systemDrive.begin(), systemDrive.end(), ' '), systemDrive.end()); // remove spaces // Logger::logThis()->info("Drive found: " + systemDrive); }