Should VolumeCount only return 1 on Linux?

I’ve just noticed that if I use Volume() and VolumeCount() on Linux, I only ever get one (0th element) volume - “/”. In my case, I have 4 real volumes mounted locally - /, /opt, /home, and /WindowsArray.

I believe I ran into this back in the REALbasic days as I used a shell and the mount command in older projects.

Is this expected functionality or should I file a feedback report.

This works for me on Linux:

[code]Protected Function getVolumePercentUsedAllDrivesWAD() as String
Dim Results As String
Dim numDrives As Integer
Dim f As FolderItem

numDrives = VolumeCount
for tempInt As Integer = 0 to numDrives
f = Volume(tempInt)
if f <> nil and f.Exists then
if f.VolumeSizeMBS > 0 and not f.IsOnRemoteVolumeMBS then 'don’t check network or backup drives
Results = Results + commonStrings.getNumberAsPercentageWAD((f.VolumeSizeMBS - f.VolumeFreeSizeMBS) / f.VolumeSizeMBS) + " " + f.Name + if(f.IsEjectableVolumeMBS, " [Ejectable]", “”)
if tempInt <> numDrives then Results = Results + EndOfLine
end if
end if

Return Results

Exception err
commonOS.doHandleExceptionWAD(err, CurrentMethodName)

End Function[/code]

Giving the result:

67% / 0% dev 0% shm 3% run 0% lock 0% cgroup 0% tmp 0% shm

@Tim Jones — I think that Volumes in Xojo only take into account physical and logical disks/partitions. BTW, /opt and /home are mounting points, not volumes.

Whatever the underlying OS, I expect Volumes to return only the startup disk if no other drives are connected and the startup disk only has 1 partition.

Actually, they are separate physical disks in my case and are listed by “mount” as such. This is why I’m confused as to why Volumes() and VolumeCount() don’t list them and count them. I suspect that is a bug.

Because I am only interested in physical volumes, Here is the old shell process that works:

// have to manually get the mounted volumes for now. Dim theShell As New Shell Dim theVolumes(-1) As String theShell.Mode = 1 theShell.Execute "mount | grep ^/dev | cut -d ' ' -f 3" Do theShell.Poll DoEvents(2) Loop Until Not theShell.IsRunning theVolumes = Split(theShell.ReadAll, EndOfLine) for x = 0 to theVolumes.Ubound If theVolumes(x) <> "" Then lbBackupFilesystem.AddFolder theVolumes(x) lbBackupFilesystem.Cell(lbBackupFilesystem.LastIndex, TypeColumn) = "Volume" lbBackupFilesystem.Cell(lbBackupFilesystem.LastIndex, MacPathColumn) = theVolumes(x) lbBackupFilesystem.Cell(lbBackupFilesystem.LastIndex, UnixPathColumn) = theVolumes(x) lbBackupFilesystem.RowPicture(lbBackupFilesystem.LastIndex) = RootVolume22x22 End If next

I’m going to create a Feedback report on this because Volumes() should handle this scenario for both physical and LVM volumes.