B4J Question Browse contents on a Mac with Finder

ThRuST

Well-Known Member
Licensed User
Longtime User
How to open any of the drives to browse contents on a Mac? I've heard that Finder is equal to Explorer on a PC but how is this done?
What I try to do is to add a list of available units that will be shown in a trayicon, which should work on both PC and Mac. For example the following drive info should be accessible from both PC and Mac:

* Available partition
* Drive name
* Available space
* Total space

When an item in the list is clicked, the contents should be shown in finder on Mac and Explorer on PC. Also how does this work on Linux and perhaps if Java works on Ubuntu and other platforms? Btw the equality to Taskbar in Windows should be the 'Dock' on Mac.
I assume it can be rightclicked and selected just as in the trayicon on PC!!!

What I do is to check OS and set a global flag:
B4X:
' Detect operating system

Dim os As String = GetSystemProperty("os.name", "").ToLowerCase
Log(os)
If os.Contains("win") Then
   ' Set variable here
Else If os.Contains("mac") Then
   ' Set variable here
Else
   'Linux
   ' Set variable here
End If

Get list of available drives
B4X:
For Each drive As String In ListRoots
   Log(drive)
Next

Sub ListRoots As List
   Dim jo As JavaObject
   Dim o() As Object = jo.InitializeStatic("java.io.File").RunMethod("listRoots", Null)
   Return o
End Sub

It would be convenient to access drives and have it opened in finder on Mac and Explorer on PC, and how to browse contents on Linux and Ubuntu?
 
Last edited:
Top