desktop/source/lib/init.cxx            |    8 ++++++++
 include/unotools/pathoptions.hxx       |    1 +
 unotools/source/config/pathoptions.cxx |    6 ++++++
 3 files changed, 15 insertions(+)

New commits:
commit 21e58b94a2390a17571c30e91254f116d1566a2d
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Thu Nov 30 15:36:57 2023 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Tue Jan 2 13:00:33 2024 +0100

    lok: import Work path from LOK_WORKDIR
    
    Change-Id: If0c9727f53c1c4dfb78d1ccbd6b3ff602268bbf7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160156
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161059
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index cc3139fcd22e..a54ebc6e469f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -7977,6 +7977,14 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
             OUString aNewTemp;
             osl::FileBase::getTempDirURL(aNewTemp);
             aOptions.SetTempPath(aNewTemp);
+            {
+                const char *pWorkPath = getenv("LOK_WORKDIR");
+                if (pWorkPath)
+                {
+                    OString sWorkPath(pWorkPath);
+                    aOptions.SetWorkPath(OStringToOUString(sWorkPath, 
RTL_TEXTENCODING_UTF8));
+                }
+            }
             desktop::Desktop::CreateTemporaryDirectory();
 
             // The RequestHandler is specifically set to be ready when all the 
other
diff --git a/include/unotools/pathoptions.hxx b/include/unotools/pathoptions.hxx
index c7468048d5df..c19a2b34baf4 100644
--- a/include/unotools/pathoptions.hxx
+++ b/include/unotools/pathoptions.hxx
@@ -106,6 +106,7 @@ public:
     void            SetAutoTextPath( const OUString& rPath );
     void            SetBasicPath( const OUString& rPath );
     void            SetTempPath( const OUString& rPath );
+    void            SetWorkPath( const OUString& rPath );
 
     OUString        SubstituteVariable( const OUString& rVar ) const;
     OUString        ExpandMacros( const OUString& rPath ) const;
diff --git a/unotools/source/config/pathoptions.cxx 
b/unotools/source/config/pathoptions.cxx
index 24c1fb323dcc..4234ec903df9 100644
--- a/unotools/source/config/pathoptions.cxx
+++ b/unotools/source/config/pathoptions.cxx
@@ -122,6 +122,7 @@ class SvtPathOptions_Impl
         void            SetAutoTextPath( const OUString& rPath ) { SetPath( 
SvtPathOptions::Paths::AutoText, rPath ); }
         void            SetBasicPath( const OUString& rPath ) { SetPath( 
SvtPathOptions::Paths::Basic, rPath ); }
         void            SetTempPath( const OUString& rPath ) { SetPath( 
SvtPathOptions::Paths::Temp, rPath ); }
+        void            SetWorkPath( const OUString& rPath ) { SetPath( 
SvtPathOptions::Paths::Work, rPath ); }
 
         OUString   SubstVar( const OUString& rVar ) const;
         OUString   ExpandMacros( const OUString& rPath ) const;
@@ -589,6 +590,11 @@ void SvtPathOptions::SetTempPath( const OUString& rPath )
     pImpl->SetTempPath( rPath );
 }
 
+void SvtPathOptions::SetWorkPath( const OUString& rPath )
+{
+    pImpl->SetWorkPath( rPath );
+}
+
 OUString SvtPathOptions::SubstituteVariable( const OUString& rVar ) const
 {
     return pImpl->SubstVar( rVar );

Reply via email to