SubName: GetVolumeLabel
Description: Returns the name of a volume (for example: 'RECOVERY').
Depends On: JavaObject
Example:
Tags: Volume Label
Notes: Has only been tested on Windows, unsure if it will work on Mac or Linux.
Description: Returns the name of a volume (for example: 'RECOVERY').
Depends On: JavaObject
B4X:
Sub GetVolumeLabel(Path As String) As String
Dim JO As JavaObject
Dim Dir As JavaObject
JO = JO.InitializeStatic("javax.swing.filechooser.FileSystemView").RunMethod("getFileSystemView", Null)
Dir.InitializeNewInstance("java.io.File", Array As Object(Path))
Return JO.RunMethod("getSystemDisplayName", Array As Object(Dir))
End Sub
Example:
B4X:
GetVolumeLabel("C:\") 'Returns "Local Disk (C:\)" on my Windows machine.
Tags: Volume Label
Notes: Has only been tested on Windows, unsure if it will work on Mac or Linux.