ignore system drive
This commit is contained in:
parent
a665f8638e
commit
77b322d47d
@ -344,15 +344,29 @@ void reHDD::searchDrives(list<Drive> *plistDrives)
|
||||
*/
|
||||
void reHDD::filterIgnoredDrives(list<Drive> *plistDrives)
|
||||
{
|
||||
list<tuple<string>> 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<Drive>::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<tuple<string>> 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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user