diff --git a/src/reHDD.cpp b/src/reHDD.cpp index 895745f..5cc7443 100644 --- a/src/reHDD.cpp +++ b/src/reHDD.cpp @@ -294,7 +294,7 @@ void reHDD::searchDrives(list * plistDrives) char * cLine = NULL; size_t len = 0; - FILE* outputfileHwinfo = popen("ls -1 /dev/sd*", "r"); + FILE* outputfileHwinfo = popen("lsblk -I 8 -d -o NAME", "r"); if (outputfileHwinfo == NULL) { @@ -304,13 +304,13 @@ void reHDD::searchDrives(list * plistDrives) while ((getline(&cLine, &len, outputfileHwinfo)) != -1) { - if (string(cLine).length() == 9) + if (string(cLine).length() == 4) { - Drive* tmpDrive = new Drive(string(cLine).substr(0, 8)); + Drive* tmpDrive = new Drive("/dev/" + string(cLine).substr(0, 3)); tmpDrive->state = Drive::NONE; tmpDrive->bIsOffline = false; plistDrives->push_back(*tmpDrive); - Logger::logThis()->info("search drives: " + tmpDrive->getPath()); + Logger::logThis()->info("drive found: " + tmpDrive->getPath()); } } fclose(outputfileHwinfo);