diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2019-10-10 12:39:35 +0200 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2019-10-10 12:39:35 +0200 |
commit | 9db25302bfb454dd8f2504e59ca84815f48e5cf4 (patch) | |
tree | 0db7f8aa4c0f273fd425084ad6d5e48781dca887 /wizards | |
parent | 8e2d9c7620b9fc32c98768029a22e0fa20007084 (diff) |
Access2Base - CurrentUser based in PathSubstitution
com.sun.star.util.PathSubstitution service provides
a "$(username)" variable since LO 5.2
This technique replaces the use of environment variables
Change-Id: Icca82d88a123312031874d355655d26718fb215b
Diffstat (limited to 'wizards')
-rw-r--r-- | wizards/source/access2base/Application.xba | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/wizards/source/access2base/Application.xba b/wizards/source/access2base/Application.xba index 3bc2837aac2a..91ca6aca9081 100644 --- a/wizards/source/access2base/Application.xba +++ b/wizards/source/access2base/Application.xba @@ -812,16 +812,11 @@ End Function ' CurrentDb V1.1.0 REM ----------------------------------------------------------------------------------------------------------------------- Public Function CurrentUser() As String -Const cstWindows = 1 -Const cstUnix = 4 - Select Case GetGuiType() - Case cstWindows - CurrentUser = Environ("USERNAME") - Case cstUnix - CurrentUser = Environ("USER") - Case Else - CurrentUser = "" - End Select +Dim oPath As Object, sUser As String + + Set oPath = CreateUnoService("com.sun.star.util.PathSubstitution") + sUser = oPath.getSubstituteVariableValue("$(username)") ' New since LibreOffice 5.2 + CurrentUser = sUser End Function ' CurrentUser V0.9.1 |