officecfg/registry/schema/org/openoffice/Office/Common.xcs |    9 +++++++++
 sfx2/source/doc/docfile.cxx                                |    3 +++
 2 files changed, 12 insertions(+)

New commits:
commit dcb2e2515bad3028918e0121068fac7b1d6881d3
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Mon Feb 5 14:12:53 2024 +0100
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
CommitDate: Thu Feb 8 08:48:08 2024 +0100

    tdf#158975 Add option to not write temp file next to local file
    
    This causes permission issues in some setups.
    See bug report for details.
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163003
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    (cherry picked from commit cf616121ed48c8df96104bc35abf3b55b8862043)
    
    Change-Id: If97030f95185ab96e21cec968b734fba8a811f9d

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 3fdf08d9e19a..b47794f128c4 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5489,6 +5489,15 @@
         </info>
         <value>true</value>
       </prop>
+      <prop oor:name="TempFileNextToLocalFile" oor:type="xs:boolean" 
oor:nillable="false">
+        <info>
+          <desc>Determines if temp files are placed next to the local file 
when a file is saved.
+          If this is false, the temp file will be placed in the default temp 
directory.
+          Placing the temp file next to the local file will increase 
performance, but it might lead
+          to permission issues such as described in this bug: 
https://bugs.documentfoundation.org/show_bug.cgi?id=158975</desc>
+        </info>
+        <value>true</value>
+      </prop>
       <prop oor:name="UseDocumentOOoLockFile" oor:type="xs:boolean" 
oor:nillable="false">
         <info>
           <desc>Allows to specify whether the OOo document file locking
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 8c0d101c4ea9..5c4116f2308e 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -3674,6 +3674,9 @@ OUString GetLogicBase(std::unique_ptr<SfxMedium_Impl> 
const & pImpl)
 // permission only to create the specifically named output file in that 
directory.
 #if !HAVE_FEATURE_MACOSX_SANDBOX
 
+    if (!officecfg::Office::Common::Misc::TempFileNextToLocalFile::get())
+        return aLogicBase;
+
     if (comphelper::isFileUrl(pImpl->m_aLogicName) && !pImpl->m_pInStream)
     {
         // Try to create the temp file in the same directory when storing.

Reply via email to