I’m sorry that I led you to look at the MBS plugin while in fact the code I was thinking about doesn’t need it. I’ve finally found the function in my archives:
Public Function VolumeIsBrowsable(Extends target as FolderItem) As Boolean
Soft Declare Function NSClassFromString Lib "AppKit" (classname As CFStringRef) As ptr
Soft Declare Function fileURLWithPathIsDirectory Lib "Foundation" Selector "fileURLWithPath:isDirectory:" (NSURLClass As Ptr,path As CFStringRef,directory As Boolean) As Ptr
Soft Declare Function getResourceValue Lib "Foundation" Selector "getResourceValue:forKey:error:" (URLRef As Ptr,ByRef value As Ptr,key As CFStringRef,ByRef error As Ptr) As Boolean
Soft Declare Function boolValue Lib "Foundation" Selector "boolValue" (ref As Ptr) As Boolean // for converting NSNumber boolean to Xojo
Var NSURLClass As Ptr=NSClassFromString("NSURL")
Var nativePath As String=target.nativePath
Var myURL As Ptr=fileURLWithPathIsDirectory(NSURLClass,nativePath,target.directory)
Var error As ptr
Var result As ptr
If Not GetResourceValue(myURL,result,"NSURLVolumeIsBrowsableKey",error) Then
System.DebugLog "Can't check for browsable key!"
Return False
End
Return boolValue(result)
End Function
This function tells whether a given volume is shown in the Finder and open/save/select folder dialogs.