[Libreoffice-commits] core.git: include/unotools sw/qa unotools/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 27 13:09:21 UTC 2019


 include/unotools/tempfile.hxx           |    4 ++++
 sw/qa/extras/ooxmlexport/ooxmllinks.cxx |    7 +------
 unotools/source/ucbhelper/tempfile.cxx  |    6 ++++++
 3 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit 3bed509302127f0bb82898b2637c4372aee796ef
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Aug 27 10:30:47 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Aug 27 15:07:48 2019 +0200

    Use a direct way to get at the temp dir
    
    ...in code originally added with 2b2f1352c72280dd25ed3bef090a3c708ee4b964
    "tdf#86087 Save relative links in DOCX", by introducing
    utl::TempFile::GetTempNameBaseDirectory
    
    Change-Id: Ic0e8b54896a3829c081255404ef92b96f1724a2a
    Reviewed-on: https://gerrit.libreoffice.org/78174
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/include/unotools/tempfile.hxx b/include/unotools/tempfile.hxx
index 57f0fef8a940..b77d6e3a798f 100644
--- a/include/unotools/tempfile.hxx
+++ b/include/unotools/tempfile.hxx
@@ -132,6 +132,10 @@ public:
                     It is not a URL because all URLs must be "UCB compatible", so there may be no suitable URL at all.
                     */
     static OUString SetTempNameBaseDirectory( const OUString &rBaseName );
+
+    // Return the URL of the temp directory (the one set with SetTempNameBaseDirectory or the
+    // default tempfile folder):
+    static OUString GetTempNameBaseDirectory();
 };
 
 }
diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
index 476c4fc5408d..6bfeb8cda870 100644
--- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
@@ -47,12 +47,7 @@
                                      : aOriginalURL.GetLastName();                                 \
                                                                                                    \
             /* Get temp path */                                                                    \
-            OUString sTempDir = utl::TempFile::CreateTempName();                                   \
-            INetURLObject aTempURL;                                                                \
-            aTempURL.setFSysPath(sTempDir, FSysStyle::Detect);                                     \
-            /* remove file name */                                                                 \
-            aTempURL.removeSegment();                                                              \
-            sTempDir = INetURLObject::GetScheme(aTempURL.GetProtocol()) + aTempURL.GetURLPath();   \
+            OUString sTempDir = utl::TempFile::GetTempNameBaseDirectory();                         \
                                                                                                    \
             /* Create & apply new URL */                                                           \
             OUString sOriginalFileInTempDir = sTempDir + sFileName;                                \
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index 9e582658bd89..83c2effa919e 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -468,6 +468,12 @@ OUString TempFile::SetTempNameBaseDirectory( const OUString &rBaseName )
 
     return aTmp;
 }
+
+OUString TempFile::GetTempNameBaseDirectory()
+{
+    return ConstructTempDir_Impl(nullptr);
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list