Identifying the operating system can be performed with Python or Basic language.
- %PRODUCTNAME Basic lacks Mac OS X native recognition while ComputerName property is solely available for Windows. Basic calls to Python macros help overcome such limitations.
+ ComputerName property is solely available for Windows. Basic calls to Python macros help overcome %PRODUCTNAME Basic limitations.
-
+ %PRODUCTNAME Basic lacks MacOS X native recognition. Platform identification is possible using %PRODUCTNAME Application Programming Interface (API).
+ Option CompatibleOption ClassModuleOption Explicit
@@ -59,24 +62,33 @@
End Property ' Platform.DirSeparatorPublic Property Get IsLinux As Boolean
- isLinux = ( GetGUIType()=4 ) ' Applies to Mac OS X as well
+ isLinux = ( GetGUIType()=4 ) ' Applies to MacOS X as well End Property ' Platform.isLinux
+ Public Property Get IsMacOSX As Boolean
+ isMacOSX = ( OSName="MAC" )
+ End Property ' Platform.isMacOSX
+ Public Property Get IsWindows As Boolean isWindows = ( GetGUIType()=1 )End Property ' Platform.isWindowsPublic Property Get OSName As String
- Select Case GetGUIType()
- Case 1 : OSName = "Windows"
- Case 4 : OSName = "Linux"
- End Select
+ ' Return platform name as "MAC", "UNIX", "WIN"
+ ' Inferred from "Tools.UCB.ShowHelperDialog" function
+
+ With Basiclibraries
+ If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools")
+ End With
+ Dim keyNode As Object 'com.sun.star.configuration.ConfigurationAccess
+ keyNode = Tools.Misc.GetRegistryKeyContent("org.openoffice.Office.Common/Help")
+ OSName = keyNode.GetByName("System")End Property ' Platform.OSNamePublic Property Get PathDelimiter As String Select Case OSName
- Case "Linux" : PathDelimiter = ":"
- Case "Windows" : PathDelimiter = ";"
+ Case "MAC", "UNIX" : PathDelimiter = ":"
+ Case "WIN" : PathDelimiter = ";" End SelectEnd Property ' Platform.PathDelimiter
@@ -107,7 +119,7 @@
-
@@ -115,4 +127,4 @@