Platforms to show: All Mac Windows Linux Cross-Platform

Back to FolderItem class.

FolderItem.DarwinMediaInfoMBS as CFDictionaryMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Files MBS MacCF Plugin 5.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the info dictionary of the media.
Example
// info for boot volume
dim info as CFDictionaryMBS = volume(0).DarwinMediaInfoMBS

if info = nil then
beep // error
else
CFShowMBS info // show in console

dim RemovableKey as CFStringMBS = NewCFStringMBS("Removable")
dim RemovableCFO as CFObjectMBS = info.Value(RemovableKey)
dim RemovableCFB as CFBooleanMBS = CFBooleanMBS(RemovableCFO)
dim Removable as Boolean = RemovableCFB.Value

MsgBox "Removable: "+str(Removable)

dim EjectableKey as CFStringMBS = NewCFStringMBS("Ejectable")
dim EjectableCFO as CFObjectMBS = info.Value(EjectableKey)
dim EjectableCFB as CFBooleanMBS = CFBooleanMBS(EjectableCFO)
dim Ejectable as Boolean = EjectableCFB.Value

MsgBox "Ejectable: "+str(Ejectable)

dim SizeKey as CFStringMBS = NewCFStringMBS("Size")
dim SizeCFO as CFObjectMBS = info.Value(SizeKey)
dim SizeCFN as CFNumberMBS = CFNumberMBS(SizeCFO)
dim Size as Double = SizeCFN.doubleValue / 1000000000.0

MsgBox "Size: "+str(Size, "0.0")+" GB"
end if

Returns nil on any problem.

example output for the example code above:
<CFDictionary 0x7d60510 [0xa01900e0]>{type = fixed-mutable, count = 14, capacity = 14, pairs = (
0 : <CFString 0x7d5ffe0 [0xa01900e0]>{contents = "Leaf"} = <CFBoolean 0xa0190b98 [0xa01900e0]>{value = false}
1 : <CFString 0x7d60160 [0xa01900e0]>{contents = "Writable"} = <CFBoolean 0xa0190b90 [0xa01900e0]>{value = true}
2 : <CFString 0x7d60310 [0xa01900e0]>{contents = "BSD Minor"} = <CFNumber 0x7d60300 [0xa01900e0]>{value = +0, type = kCFNumberSInt32Type}
6 : <CFString 0x7d60040 [0xa01900e0]>{contents = "Preferred Block Size"} = <CFNumber 0x7d5fe90 [0xa01900e0]>{value = +512, type = kCFNumberSInt64Type}
11 : <CFString 0x7d604c0 [0xa01900e0]>{contents = "BSD Major"} = <CFNumber 0x7d604b0 [0xa01900e0]>{value = +14, type = kCFNumberSInt32Type}
13 : <CFString 0x7d603b0 [0xa01900e0]>{contents = "BSD Name"} = <CFString 0x7d60110 [0xa01900e0]>{contents = "disk0"}
14 : <CFString 0x7d600d0 [0xa01900e0]>{contents = "Size"} = <CFNumber 0x7d60090 [0xa01900e0]>{value = +163928604672, type = kCFNumberSInt64Type}
15 : <CFString 0x7d5fef0 [0xa01900e0]>{contents = "Content Hint"} = <CFString 0xa0196304 [0xa01900e0]>{contents = ""}
16 : <CFString 0x7d60020 [0xa01900e0]>{contents = "Removable"} = <CFBoolean 0xa0190b98 [0xa01900e0]>{value = false}
17 : <CFString 0x7d601b0 [0xa01900e0]>{contents = "IOMediaIcon"} = <CFDictionary 0x7d60360 [0xa01900e0]>{type = fixed-mutable, count = 2, capacity = 2, pairs = (
2 : <CFString 0x7d60250 [0xa01900e0]>{contents = "CFBundleIdentifier"} = <CFString 0x7d602a0 [0xa01900e0]>{contents = "com.apple.iokit.IOStorageFamily"}
3 : <CFString 0x7d5ff30 [0xa01900e0]>{contents = "IOBundleResourceFile"} = <CFString 0x7d60230 [0xa01900e0]>{contents = "Internal.icns"}
)}
19 : <CFString 0x7d603d0 [0xa01900e0]>{contents = "BSD Unit"} = <CFNumber 0x7d5ff50 [0xa01900e0]>{value = +0, type = kCFNumberSInt32Type}
20 : <CFString 0x7d5ff90 [0xa01900e0]>{contents = "Ejectable"} = <CFBoolean 0xa0190b98 [0xa01900e0]>{value = false}
21 : <CFString 0x7d5fea0 [0xa01900e0]>{contents = "Content"} = <CFString 0x7d5ff10 [0xa01900e0]>{contents = "Apple_partition_scheme"}
22 : <CFString 0x7d60120 [0xa01900e0]>{contents = "Whole"} = <CFBoolean 0xa0190b90 [0xa01900e0]>{value = true}
)}

If you don't like all the CFDictionaryMBS methods, than use Dictionary function it to get a Xojo dictionary.

Blog Entries

The items on this page are in the following plugins: MBS MacCF Plugin.


The biggest plugin in space...