summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-09-10 21:01:07 +0200
committerCaolán McNamara <caolanm@redhat.com>2018-09-17 15:58:31 +0200
commitf06aea9b31707ec49355e41b0e682d4a15431e44 (patch)
tree22bf1a21154cc77802f2de823d1cc967a7031a83
parent4db4befcb7f710cb9ec0dcc9968ee2d0b836a1c2 (diff)
tdf#119316 sfx2 store: no move on macOS
osl::FileStatus::getAttributes() and osl::File::setAttributes() doesn't preserve all the necessary file properties (at least "Hide extension" is not handled), so always copy on macOS instead. (cherry picked from commit 7823684cb6fbe752dc64300799c5d102f61e0b70) Change-Id: I529467cc3d432d04e593f936c13ed4656a18150c Reviewed-on: https://gerrit.libreoffice.org/60307 Tested-by: Jenkins Tested-by: Xisco Faulí <xiscofauli@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sfx2/source/doc/docfile.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index e6a858ae6bf8..a852a01e644e 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -199,10 +199,17 @@ sal_uInt64 GetDefaultFileAttributes(const OUString& rURL)
return nRet;
}
-/// Determines if rURL is a non-linked (symlink or hardlink) file:// URL.
-bool IsNotLinkedFile(const OUString& rURL)
+/// Determines if rURL is safe to move or not.
+bool IsFileMovable(const OUString& rURL)
{
+#ifdef MACOSX
+ (void)rURL;
+ // Hide extension macOS-specific file property would be lost.
+ return false;
+#else
+
if (!comphelper::isFileUrl(rURL))
+ // Not a file:// URL.
return false;
#ifdef UNX
@@ -220,6 +227,7 @@ bool IsNotLinkedFile(const OUString& rURL)
#endif
return true;
+#endif
}
} // anonymous namespace
@@ -1852,7 +1860,7 @@ void SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource,
OUString aDestMainURL = aDest.GetMainURL(INetURLObject::DecodeMechanism::NONE);
sal_uInt64 nAttributes = GetDefaultFileAttributes(aDestMainURL);
- if (IsNotLinkedFile(aDestMainURL) && osl::File::move(aSourceMainURL, aDestMainURL) == osl::FileBase::E_None)
+ if (IsFileMovable(aDestMainURL) && osl::File::move(aSourceMainURL, aDestMainURL) == osl::FileBase::E_None)
{
if (nAttributes)
// Adjust attributes, source might be created with