[disk]darwin,freebsd: implements 'all' argument.

pull/185/head
Shirou WAKAYAMA 9 years ago
parent ca99d7dc3f
commit f2ebb91cf0

@ -3,6 +3,7 @@
package disk
import (
"path"
"syscall"
"unsafe"
@ -74,6 +75,12 @@ func Partitions(all bool) ([]PartitionStat, error) {
Fstype: common.IntToString(stat.Fstypename[:]),
Opts: opts,
}
if all == false {
if !path.IsAbs(d.Device) || !common.PathExists(d.Device) {
continue
}
}
ret = append(ret, d)
}

@ -5,6 +5,7 @@ package disk
import (
"bytes"
"encoding/binary"
"path"
"strconv"
"syscall"
"unsafe"
@ -81,6 +82,12 @@ func Partitions(all bool) ([]PartitionStat, error) {
Fstype: common.IntToString(stat.Fstypename[:]),
Opts: opts,
}
if all == false {
if !path.IsAbs(d.Device) || !common.PathExists(d.Device) {
continue
}
}
ret = append(ret, d)
}

Loading…
Cancel
Save