fsSize() WLS fix windows
This commit is contained in:
+12
-10
@@ -52,7 +52,7 @@ function fsSize(callback) {
|
||||
lines.forEach(function (line) {
|
||||
if (line !== '') {
|
||||
line = line.replace(/ +/g, ' ').split(' ');
|
||||
if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0))) {
|
||||
if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0) || (line[0].indexOf(':') === 1))) {
|
||||
const fs = line[0];
|
||||
const fsType = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0]));
|
||||
const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024;
|
||||
@@ -129,15 +129,17 @@ function fsSize(callback) {
|
||||
lines.forEach(function (line) {
|
||||
if (line !== '') {
|
||||
line = line.trim().split(/\s\s+/);
|
||||
data.push({
|
||||
fs: line[0],
|
||||
type: line[1],
|
||||
size: parseInt(line[3], 10),
|
||||
used: parseInt(line[3], 10) - parseInt(line[2], 10),
|
||||
available: parseInt(line[2], 10),
|
||||
use: parseFloat((100.0 * (parseInt(line[3]) - parseInt(line[2]))) / parseInt(line[3])),
|
||||
mount: line[0]
|
||||
});
|
||||
if (line.length >= 4 && parseInt(line[3], 10)) {
|
||||
data.push({
|
||||
fs: line[0],
|
||||
type: line[1],
|
||||
size: parseInt(line[3], 10),
|
||||
used: parseInt(line[3], 10) - parseInt(line[2], 10),
|
||||
available: parseInt(line[2], 10),
|
||||
use: parseFloat(((100.0 * (parseInt(line[3]) - parseInt(line[2]))) / parseInt(line[3])).toFixed(2)),
|
||||
mount: line[0]
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
if (callback) {
|
||||
|
||||
Reference in New Issue
Block a user