Xojo FileBrowser example shows hidden volumes?

Hi.

The FileBrowser example in ‘Xojo 2021r31 Examples’ lists out all the hidden volumes in OS 12.2 on myM1 Mac ( such as VM, Preboot, xarts, iSCPreboot, Hardware, Data, home). I don’t think it should be doing this. If I try to add some code branching to ignore these hidden volumes by just checking against the f.Name that ought to be hidden and skipping the following code…

AddExpandableRow(f.Name)
Var currentFolder As FolderItem = New FolderItem("", FolderItem.PathModes.Native)
RowTagAt(i) = f.SaveInfo(currentFolder)

…I just get ‘out of bounds exceptions’ no matter what I try.

Can anyone with an M1 Mac and Xojo 2021r31 help out.

Thanks

Which listbox are you trying to add to?

LisboxName.AddExpandableRow(f.Name)
Var currentFolder As FolderItem = New FolderItem("", FolderItem.PathModes.Native)
LisboxName.RowTagAt(i) = f.SaveInfo(currentFolder)

Also what is f, it isn’t defined in the code.

its the ‘FileBrowser’ example project that comes with Xojo. Just run it on an M1 Mac with AFPS disks and you’ll see that the unwritable hidden volumes appear.

Its normal. If you want to show only visible files, you got to check for the visible property.
https://documentation.xojo.com/api/files/folderitem.html.Visible

Use another command to choose items from mass storage devices, just like OpenDialog.

AN example is… an example. Reading the Language Reference is good too.

Reporting all items from a mass storage device is what FileBrowser is meant to do.

Hello, thanks for replying. With folderitem.Visible, the hidden volumes still show up in the VolumeBrowser list in the Xojo example project: ‘FileBrowser’ , which is supplied with the Xojo IDE. I get a crash when reading the folderitem of the AFPS user data volume associated with the OS boot volume.

If i leave the Filebrowser example project exactly as the original (supplied by Xojo) without adding the ‘if f.Visible…then’, i get no crash BUT still a list of all volumes, visible and hidden.

My OS is running flawlessly on a Thunderbolt drive that is AFPS partitioned for System files (Rocket OS) and User data (Rocket Files). so to reiterate, if I do any kind of if-then statement such as if.Visible, to remove hidden volumes, Xojo crashes with an out of bounds error when reading the Rocket Files volume.

Something is clearly not right.

Here’s the open event code that causes out of bounds crash.

For i As Integer = 0 To FolderItem.DriveCount - 1
  f = FolderItem.DriveAt(i)
  if f.Visible Then
    AddExpandableRow(f.Name)
    Var currentFolder As FolderItem = New FolderItem("", FolderItem.PathModes.Native)
    VolumeBrowserList.RowTagAt(i) = f.SaveInfo(currentFolder)
  end if
Next

That is reading all items that exists in a mass storage volume: you get what you ask.

Not a very helpful comment. Please don’t bother with suggestions like, “RTFM” or “its not designed to do that”. A File and Volume browser needs to be able to ignore or hide unwanted, hidden or unwritable volumes in order to present useful information to the user. Nobody is interested in getting files from unwriteable hidden AFPS recovery volumes.

Seems to me that Xojo is having a problem with the AFPS architecture, or may be its an M1 issue.
In Xojo 2019 the same example project works fine on my Intel Mac becausee the Volumes are HFS+

SO please, helpful comments only

You are using i to index RowTagAt, but there are not i items in the listbox, because you skipped some. Use

VolumeBrowserList.RowTagAt(VolumeBrowserList.LastAddedRowIndex)

instead.

1 Like

Thanks very much Tim,

well spotted. Yes, of course… what a nonce I am!

I used f.IsWriteable = true to remove the hidden volumes. Only issue is that the OS boot drive reports it’s not writeable and so no longer appears,. I’ll try and figure something out, now that the Out of Bounds error has gone.

Don’t use DriveCount. Use

For i As Integer = 0 To FolderItem.Count - 1

https://documentation.xojo.com/api/files/folderitem.html.Count

You have come to this forum asking for help. People have been providing it. The issue is that you are not reading or not understanding it.

A little humility will go a long way in this forum. I recommend you go back and re-read the excellent feedback that others have given and see if it helps, now that you have resolved your index issue.

Excuse me Eric, but i have already thanked Tim Hare many hours ago (6 hours in fact) for pointing out my error and answering my question, so please lay off the self righteousness until you actually read the messages correctly. Exactly where is my lack of humility? My response to a nother poster who told me to RTFM and that I was trying to code in the wrong way was ‘unhelpful’ and i said so. Tim answered exactly and correctly without ‘attitude’.

Paul,

Such a forum is inherently a “cold media”, meaning since all you read is text, you have no idea what the other feelings are. In a real life conversation, someone could tell you to RTFM with a smile, and that could makes it a lot more acceptable.

Tempers flare easily on the Internet. Be the better man. Live and let live.