bugfix WMIC blockDevice parse (Windows 7)
This commit is contained in:
parent
0fb74227ac
commit
5d818d79b3
@ -99,6 +99,7 @@ Other changes
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| -------------- | -------------- | -------- |
|
| -------------- | -------------- | -------- |
|
||||||
|
| 3.33.10 | 2017-12-14 | bugfix WMIC blockDevice parse (Windows 7) |
|
||||||
| 3.33.9 | 2017-12-14 | bugfix WMIC not found (Windows) |
|
| 3.33.9 | 2017-12-14 | bugfix WMIC not found (Windows) |
|
||||||
| 3.33.8 | 2017-12-02 | bugfix diskLayout().size (OSX) |
|
| 3.33.8 | 2017-12-02 | bugfix diskLayout().size (OSX) |
|
||||||
| 3.33.7 | 2017-11-28 | bugfix diskLayout().size |
|
| 3.33.7 | 2017-11-28 | bugfix diskLayout().size |
|
||||||
|
|||||||
@ -237,25 +237,27 @@ function blockDevices(callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (_windows) {
|
if (_windows) {
|
||||||
exec(util.getWmic() + ' logicaldisk get Caption,Description,DeviceID,DriveType,FileSystem,FreeSpace,Name,Size,VolumeName,VolumeSerialNumber /format:csv', function (error, stdout) {
|
let drivetypes = ['Unknown', 'NoRoot', 'Removable', 'HDD', 'Network', 'CD/DVD', 'RAM']
|
||||||
|
exec(util.getWmic() + ' logicaldisk get Caption,Description,DeviceID,DriveType,FileSystem,FreeSpace,Name,Size,VolumeName,VolumeSerialNumber /value', function (error, stdout) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
|
let devices = stdout.toString().split(/\n\s*\n/);
|
||||||
lines.forEach(function (line) {
|
devices.forEach(function (device) {
|
||||||
if (line !== '') {
|
let lines = device.split('\r\n');
|
||||||
line = line.replace('\r', '').split(',');
|
let drivetype = util.getValue(lines, 'drivetype', '=');
|
||||||
|
if (drivetype) {
|
||||||
data.push({
|
data.push({
|
||||||
name: line[7],
|
name: util.getValue(lines, 'name', '='),
|
||||||
identifier: line[1],
|
identifier: util.getValue(lines, 'caption', '='),
|
||||||
type: 'disk',
|
type: 'disk',
|
||||||
fstype: line[5].toLowerCase(),
|
fstype: util.getValue(lines, 'filesystem', '=').toLowerCase(),
|
||||||
mount: line[1],
|
mount: util.getValue(lines, 'caption', '='),
|
||||||
size: line[8],
|
size: util.getValue(lines, 'size', '='),
|
||||||
physical: line[4] === '5' ? 'CD/DVD' : 'HDD',
|
physical: (drivetype >= 0 && drivetype <= 6) ? drivetypes[drivetype] : drivetypes[0],
|
||||||
uuid: line[10],
|
uuid: util.getValue(lines, 'volumeserialnumber', '='),
|
||||||
label: line[9],
|
label: util.getValue(lines, 'volumename', '='),
|
||||||
model: '',
|
model: '',
|
||||||
serial: line[10],
|
serial: util.getValue(lines, 'volumeserialnumber', '='),
|
||||||
removable: line[4] === '2',
|
removable: drivetype === '2',
|
||||||
protocol: ''
|
protocol: ''
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user