summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2019-10-10 12:39:35 +0200
committerJean-Pierre Ledure <jp@ledure.be>2019-10-10 12:39:35 +0200
commit9db25302bfb454dd8f2504e59ca84815f48e5cf4 (patch)
tree0db7f8aa4c0f273fd425084ad6d5e48781dca887 /wizards
parent8e2d9c7620b9fc32c98768029a22e0fa20007084 (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.xba15
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 &apos; CurrentDb V1.1.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function CurrentUser() As String
-Const cstWindows = 1
-Const cstUnix = 4
- Select Case GetGuiType()
- Case cstWindows
- CurrentUser = Environ(&quot;USERNAME&quot;)
- Case cstUnix
- CurrentUser = Environ(&quot;USER&quot;)
- Case Else
- CurrentUser = &quot;&quot;
- End Select
+Dim oPath As Object, sUser As String
+
+ Set oPath = CreateUnoService(&quot;com.sun.star.util.PathSubstitution&quot;)
+ sUser = oPath.getSubstituteVariableValue(&quot;$(username)&quot;) &apos; New since LibreOffice 5.2
+ CurrentUser = sUser
End Function &apos; CurrentUser V0.9.1