Okay. It’s also possible to do that with the old macOSlib code (which I updated to work on 64 bit).
And to all the others who may be interested in this, including the Xojo engineers, possibly, here’s some ObjC code that shows how to see all volumes, and then look at the various flags (hidden, browsable) to determine the relevant properties of each volume:
[code]static void listVols()
{
NSArray<NSString*> keys = @[NSURLNameKey,NSURLVolumeIsBrowsableKey/,NSURLVolumeIsAutomountedKey*/,NSURLVolumeIsRootFileSystemKey,NSURLIsHiddenKey];
NSArray<NSURL*> *vols = [NSFileManager.defaultManager mountedVolumeURLsIncludingResourceValuesForKeys:keys options:0];
NSMutableArray <NSString*> *lines = [NSMutableArray new];
for (NSURL *url in vols) {
NSDictionary<NSURLResourceKey,id> *dict = [url resourceValuesForKeys:keys error:NULL];
NSMutableArray <NSString*> *props = [NSMutableArray new];
for (NSString *key in keys) {
if ([key isEqualToString:NSURLNameKey]) continue;
[props addObject:[NSString stringWithFormat:@" %@: %@", key, dict[key]]];
}
[lines addObject:[NSString stringWithFormat:@"-- %@ (%@) --\
%@", dict[NSURLNameKey], url.path, [props componentsJoinedByString:@" |"]]];
}
NSLog(@"\
%@", [lines componentsJoinedByString:@"
"]);
}
[/code]
On my Big Sur system (with two visible volumes: System and Shared), this prints:
-- System (/) --
NSURLVolumeIsBrowsableKey: 1 | NSURLVolumeIsRootFileSystemKey: 1 | NSURLIsHiddenKey: 0
-- VM (/System/Volumes/VM) --
NSURLVolumeIsBrowsableKey: 0 | NSURLVolumeIsRootFileSystemKey: 0 | NSURLIsHiddenKey: 0
-- Preboot (/System/Volumes/Preboot) --
NSURLVolumeIsBrowsableKey: 0 | NSURLVolumeIsRootFileSystemKey: 0 | NSURLIsHiddenKey: 0
-- Update (/System/Volumes/Update) --
NSURLVolumeIsBrowsableKey: 0 | NSURLVolumeIsRootFileSystemKey: 0 | NSURLIsHiddenKey: 0
-- xarts (/xarts) --
NSURLVolumeIsBrowsableKey: 0 | NSURLVolumeIsRootFileSystemKey: 0 | NSURLIsHiddenKey: 0
-- iSCPreboot (/System/Volumes/iSCPreboot) --
NSURLVolumeIsBrowsableKey: 0 | NSURLVolumeIsRootFileSystemKey: 0 | NSURLIsHiddenKey: 0
-- Hardware (/System/Volumes/Hardware) --
NSURLVolumeIsBrowsableKey: 0 | NSURLVolumeIsRootFileSystemKey: 0 | NSURLIsHiddenKey: 0
-- Shared (/Volumes/Shared) --
NSURLVolumeIsBrowsableKey: 1 | NSURLVolumeIsRootFileSystemKey: 0 | NSURLIsHiddenKey: 0
-- home (/System/Volumes/Data/home) --
NSURLVolumeIsBrowsableKey: 0 | NSURLVolumeIsRootFileSystemKey: 0 | NSURLIsHiddenKey: 1
So, as you can see, the hidden property is not really helpful. Instead, it’s the NSURLVolumeIsBrowsableKey that identifies whether the Finder shows it.
Also, this doesn’t include the linked " - Data" volumes, which is probably a good idea when using FolderItem to look at the contents of a volume as the Finder sees it.