Platforms to show: All Mac Windows Linux Cross-Platform

/MacBase/NSURL Volume Details


Required plugins for this example: MBS MacBase Plugin, MBS Main Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacBase/NSURL Volume Details

This example is the version from Sun, 6th Jun 2015.

Project "NSURL Volume Details.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub ExpandRow(row As Integer) dim volumeURL as NSURLMBS = me.RowTag(row) if volumeURL = nil then Return dim e as NSErrorMBS dim values as Dictionary = volumeURL.resourceValuesForKeys(keynames, e) if e <> nil then MsgBox e.localizeddescription end if for each k as string in keynames dim v as Variant = values.Lookup(k, nil) List.AddRow keys.lookup(k, "?").StringValue if v = nil then List.Cell(List.LastIndex, 1) = "n/a" elseif v isa date then dim d as date = v List.Cell(List.LastIndex, 1) = d.LongDate+" "+d.LongTime elseif v isa NSURLMBS then dim u as NSURLMBS = v List.Cell(List.LastIndex, 1) = u.absoluteString elseif v.Type = Variant.TypeBoolean then dim b as Boolean = v.BooleanValue if b then List.Cell(List.LastIndex, 1) = "yes" else List.Cell(List.LastIndex, 1) = "no" end if else List.Cell(List.LastIndex, 1) = v.StringValue end if next End EventHandler
End Control
EventHandler Sub Open() dim m() as NSURLMBS = NSURLMBS.mountedVolumeURLs(true) for each v as NSURLMBS in m List.AddFolder v.LocalizedName list.RowTag(list.LastIndex) = v next keys = new Dictionary keys.Value(NSURLMBS.NSURLVolumeAvailableCapacityKey) = "Available Capacity" keys.Value(NSURLMBS.NSURLVolumeCreationDateKey) = "Creation Date" keys.Value(NSURLMBS.NSURLVolumeIdentifierKey) = "Identifier" keys.Value(NSURLMBS.NSURLVolumeIsAutomountedKey) = "Is Automounted" keys.Value(NSURLMBS.NSURLVolumeIsBrowsableKey) = "Is Browsable" keys.Value(NSURLMBS.NSURLVolumeIsEjectableKey) = "Is Ejectable" keys.Value(NSURLMBS.NSURLVolumeIsInternalKey) = "Is Internal" keys.Value(NSURLMBS.NSURLVolumeIsJournalingKey) = "Is Journaling" keys.Value(NSURLMBS.NSURLVolumeIsLocalKey) = "Is Local" keys.Value(NSURLMBS.NSURLVolumeIsReadOnlyKey) = "Is ReadOnly" keys.Value(NSURLMBS.NSURLVolumeIsRemovableKey) = "Is Removable" keys.Value(NSURLMBS.NSURLVolumeLocalizedFormatDescriptionKey) = "Localized Format Description" keys.Value(NSURLMBS.NSURLVolumeLocalizedNameKey) = "Localized Name" keys.Value(NSURLMBS.NSURLVolumeMaximumFileSizeKey) = "Maximum File Size" keys.Value(NSURLMBS.NSURLVolumeNameKey) = "Name" keys.Value(NSURLMBS.NSURLVolumeResourceCountKey) = "Resource Count" keys.Value(NSURLMBS.NSURLVolumeSupportsAdvisoryFileLockingKey) = "Supports Advisory File Locking" keys.Value(NSURLMBS.NSURLVolumeSupportsCasePreservedNamesKey) = "Supports Case Preserved Names" keys.Value(NSURLMBS.NSURLVolumeSupportsCaseSensitiveNamesKey) = "Supports Case Sensitive Names" keys.Value(NSURLMBS.NSURLVolumeSupportsExtendedSecurityKey) = "Supports Extended Security" keys.Value(NSURLMBS.NSURLVolumeSupportsHardLinksKey) = "Supports Hard Links" keys.Value(NSURLMBS.NSURLVolumeSupportsJournalingKey) = "Supports Journaling" keys.Value(NSURLMBS.NSURLVolumeSupportsPersistentIDsKey) = "Supports Persistent IDs" keys.Value(NSURLMBS.NSURLVolumeSupportsRenamingKey) = "Supports Renaming" keys.Value(NSURLMBS.NSURLVolumeSupportsRootDirectoryDatesKey) = "Supports Root Directory Dates" keys.Value(NSURLMBS.NSURLVolumeSupportsSparseFilesKey) = "Supports Sparse Files" keys.Value(NSURLMBS.NSURLVolumeSupportsSymbolicLinksKey) = "Supports Symbolic Links" keys.Value(NSURLMBS.NSURLVolumeSupportsVolumeSizesKey) = "Supports Volume Sizes" keys.Value(NSURLMBS.NSURLVolumeSupportsZeroRunsKey) = "Supports Zero Runs" keys.Value(NSURLMBS.NSURLVolumeTotalCapacityKey) = "Name" keys.Value(NSURLMBS.NSURLVolumeURLForRemountingKey) = "URL For Remounting" keys.Value(NSURLMBS.NSURLVolumeURLKey) = "URL" keys.Value(NSURLMBS.NSURLVolumeUUIDStringKey) = "Volume UUID String" for each k as string in keys.keys if k <> "" then keynames.Append k end if next End EventHandler
Property keynames() As string
Property keys As Dictionary
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

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


The biggest plugin in space...