Is is something that exists per se or just a virtual object use to display the on line (connected) mass storage hardware ?
Sorry, I am not sure I was able to define what I had in mind.
Suppose you have Macintosh HD 1, Macintosh HD 2 and Macintosh HD 3 (or a HDD, a SSD and a Micro SD Card): the parents for all theose objects are /Volumes.
That is the question - and I just realized that a mounted volume is a “special” entity on the Mac. So, even though the “mountpoint” is /Volumes/MyVolumeName", the FolderItem lists the Parent as Nil. That is just wrong. I understand that “that’s the way it’s always been”, but that doesn’t make it correct. And, the POSIX layer also says that it’s incorrect since it returns the full /Volumes/BMD-MAC path as the pat and /Volumes as the parent …
So, now I have yet another example of #if … #endif code to handle yet another Macism. Oh Joy!
and then after that f.parent is nil ?
that does seem really bizarre
but I can reproduce that here with one of my volumes mounted under /Volumes
I’d file a bug report as that mount point can be accessed as
Dim volumes As folderitem = GetFolderItem("/Volumes", FolderItem.PathTypeNative)
but you cant get at it if you use a mounted volumes parent
EDIT in my case I would expect volumes and vmsparent to refer to the same point but they do not
vmsparent is nil volumes is not
Dim volumes As folderitem = GetFolderItem("/Volumes", FolderItem.PathTypeNative)
Dim vms As folderitem = GetFolderItem("/Volumes/backup1", FolderItem.PathTypeNative)
Dim vmsparent As folderitem = vms.Parent
So, if you have:
/Volumes/Boot
/Volumes/Data
/Volumes/Photos
all of these are individual hard disk (mass storage devices). What will be /Volumes ?
A single object (the same for each device) or three different objects ?
I bet one beer on the former.
I’d still file the report either way since its inconsistent
I’d expect this code to print “they are the same”
Dim volumes As folderitem = GetFolderItem("/Volumes", FolderItem.PathTypeNative)
Dim vms As folderitem = GetFolderItem("/Volumes/backup1", FolderItem.PathTypeNative)
Dim vmsparent As folderitem = vms.Parent
if vmsparent is volumes then
msbbox "they are the same"
end if
and the code itself isnt obviously wrong in any way that I can see so I dont think the expectation is wrong
The User Guide seems to confirm this as an “expected behavior” (Parent of a Volume is always “nil”). By design - even if this is irritating on those OSes where Volumes are being mounted into a moint point, and there is only a single “root”.
From a x-platform point of view, it kind of makes sense. From the macOS/Linux FileSystem, not always so much.
If someone is going to report that… please mention that a change likely breaks existing code that relies on this “documented” behavior.
Maybe it would make sense to have a “.Parent” behave like it always has (and document it more clearly).
And to introduce a new “.TrueParent” (thinking API 1). Or a “.Parent(stopAtMountPoint As Boolean = true)”.
Oh, and another Property “.IsVolume” (*) would be nice to have, too…
i That’s what I’ve seen in more than one project, example code or advice…: just check if the .Parent=nil… so that’s why changing this behavior is likely breaking existing code…[/i]
Dim volumes As folderitem = GetFolderItem("/Volumes", FolderItem.PathTypeNative)
gives you a valid folderitem is curios as it doesnt fit with the rest of the docs
Plus it isnt trying to access “the root” (that would be /)
Nor is
Dim vms As folderitem = GetFolderItem("/Volumes/backup1", FolderItem.PathTypeNative)
Dim vmsparent As folderitem = vms.Parent
access the root (again that would be /)
Theres “something” funky about how its inconsistent and to me it seems that
Dim vmsparent As folderitem = vms.Parent
setting vmsparent to nil is somehow the culprit
As for accessing volumes and getting their folderitem thats what the Volume / Folderitem.DriveAt functions do
Although since Unix can mount a volume at any point I wonder if this works properly if someone manually mounts a drive at a weird mount point and NOT in /Volumes
Suppose a person mounts a drive at ~/SomeNewDrive and does that show up in the items returned by Volume / Folderitem.DriveAt ?
[quote=478216:@Norman Palardy]Although since Unix can mount a volume at any point I wonder if this works properly if someone manually mounts a drive at a weird mount point and NOT in /Volumes
[/quote]
Yes, it does as we mount our big volume shares under /mnt/ in the same manner that we mount them on Linux, Solaris, FreeBSD, A/IX, and HP-UX, and I see normal functionality for these volumes on macOS and Linux (/mnt is reported as the parent), unlike the issue - which ONLY occurs with the macOS automounting devices under /Volumes. Windows, in these cases, is it’s own herd of wild cats …
Yes, it does. At home, I have my NAS shares mounted here: /Users/username/Library/Family/sharename
DriveCount, DriveAt recognize them.
And guess what the FolderItem.Parent’s of my mounted NAS shares are…? nil. All of them. With 2019r3.1, 2018r4, and ever since. It’s not just when mounted in /Volumes.