[Libreoffice-commits] core.git: wizards/source

Jean-Pierre Ledure (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 10 10:43:55 UTC 2019


 wizards/source/access2base/Application.xba |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

New commits:
commit 9db25302bfb454dd8f2504e59ca84815f48e5cf4
Author:     Jean-Pierre Ledure <jp at ledure.be>
AuthorDate: Thu Oct 10 12:39:35 2019 +0200
Commit:     Jean-Pierre Ledure <jp at ledure.be>
CommitDate: Thu Oct 10 12:39:35 2019 +0200

    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

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
 


More information about the Libreoffice-commits mailing list