Fix drive detect
This commit is contained in:
@@ -7,6 +7,7 @@ import oshi.hardware.HWDiskStore;
|
||||
import oshi.hardware.HardwareAbstractionLayer;
|
||||
import oshi.hardware.NetworkIF;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
@@ -62,7 +63,8 @@ public class BaseHWInfoImpl implements BasicHWInfoStrategy {
|
||||
while (rootFound == false && iterator.hasNext()) {
|
||||
var drive = iterator.next();
|
||||
for (var partition : drive.getPartitions()) {
|
||||
if (partition.getMountPoint().equals(rootMountpoint)) {
|
||||
if (partition.getMountPoint().equals(rootMountpoint) || //Check "/" or "C:"
|
||||
(Platform.isWindows() && partition.getMountPoint().equals(rootMountpoint + File.separator))) { //Check also "C:\" on Windows
|
||||
hddSerial = drive.getSerial();
|
||||
rootFound = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user