bugfix diskLayout().size (OSX)
This commit is contained in:
parent
c67ebeadd0
commit
5f2ff90666
@ -99,6 +99,7 @@ Other changes
|
||||
|
||||
| Version | Date | Comment |
|
||||
| -------------- | -------------- | -------- |
|
||||
| 3.33.8 | 2017-12-02 | bugfix diskLayout().size (OSX) |
|
||||
| 3.33.7 | 2017-11-28 | bugfix diskLayout().size |
|
||||
| 3.33.6 | 2017-11-16 | bugfix diskLayout().size |
|
||||
| 3.33.5 | 2017-11-09 | code cleanup |
|
||||
|
||||
@ -625,16 +625,19 @@ function diskLayout(callback) {
|
||||
const mediumType = util.getValue(lines, 'Medium Type', ':', true).trim();
|
||||
const sizeStr = util.getValue(lines, 'capacity', ':', true).trim();
|
||||
if (sizeStr) {
|
||||
let size = parseInt(sizeStr.match(/\(([^)]+)\)/)[1].replace(/\./g, ''));
|
||||
if (!size) {
|
||||
size = parseInt(sizeStr);
|
||||
let sizeValue = 0;
|
||||
if (sizeStr.indexOf('(') >= 0) {
|
||||
sizeValue = parseInt(sizeStr.match(/\(([^)]+)\)/)[1].replace(/\./g, '').replace(/,/g, ''));
|
||||
}
|
||||
if (!sizeValue) {
|
||||
sizeValue = parseInt(sizeStr);
|
||||
}
|
||||
if (size) {
|
||||
if (sizeValue) {
|
||||
result.push({
|
||||
type: mediumType.startsWith('Solid') ? 'SSD' : 'HD',
|
||||
name: util.getValue(lines, 'Model', ':', true).trim(),
|
||||
vendor: '',
|
||||
size: size,
|
||||
size: sizeValue,
|
||||
bytesPerSector: -1,
|
||||
totalCylinders: -1,
|
||||
totalHeads: -1,
|
||||
@ -658,16 +661,19 @@ function diskLayout(callback) {
|
||||
const linkWidth = util.getValue(lines, 'link width', ':', true).trim();
|
||||
const sizeStr = util.getValue(lines, '!capacity', ':', true).trim();
|
||||
if (sizeStr) {
|
||||
let size = parseInt(sizeStr.match(/\(([^)]+)\)/)[1].replace(/\./g, ''));
|
||||
if (!size) {
|
||||
size = parseInt(sizeStr);
|
||||
let sizeValue = 0;
|
||||
if (sizeStr.indexOf('(') >= 0) {
|
||||
sizeValue = parseInt(sizeStr.match(/\(([^)]+)\)/)[1].replace(/\./g, '').replace(/,/g, ''));
|
||||
}
|
||||
if (!sizeValue) {
|
||||
sizeValue = parseInt(sizeStr);
|
||||
}
|
||||
if (size) {
|
||||
result.push({
|
||||
if (sizeValue) {
|
||||
result.push({
|
||||
type: 'NVMe',
|
||||
name: util.getValue(lines, 'Model', ':', true).trim(),
|
||||
vendor: '',
|
||||
size: size,
|
||||
size: sizeValue,
|
||||
bytesPerSector: -1,
|
||||
totalCylinders: -1,
|
||||
totalHeads: -1,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user