diff options
Diffstat (limited to 'sfx2/source/doc/docfile.cxx')
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 9e55c128bb71..61e92a3e0d5f 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -202,7 +202,7 @@ sal_uInt64 GetDefaultFileAttributes(const OUString& rURL) } /// Determines if rURL is safe to move or not. -bool IsFileMovable(const OUString& rURL) +bool IsFileMovable(const INetURLObject& rURL) { #ifdef MACOSX (void)rURL; @@ -210,22 +210,25 @@ bool IsFileMovable(const OUString& rURL) return false; #else - if (!comphelper::isFileUrl(rURL)) + if (rURL.GetProtocol() != INetProtocol::File) // Not a file:// URL. return false; #ifdef UNX - OUString rPath; - if (osl::FileBase::getSystemPathFromFileURL(rURL, rPath) != osl::FileBase::E_None) + OUString sPath = rURL.getFSysPath(FSysStyle::Unix); + if (sPath.isEmpty()) return false; struct stat buf; - if (lstat(rPath.toUtf8().getStr(), &buf) != 0) + if (lstat(sPath.toUtf8().getStr(), &buf) != 0) return false; // Hardlink or symlink: osl::File::move() doesn't play with these nicely. if (buf.st_nlink > 1 || S_ISLNK(buf.st_mode)) return false; +#elif defined _WIN32 + if (tools::IsMappedWebDAVPath(rURL)) + return false; #endif return true; @@ -1845,7 +1848,7 @@ void SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource, OUString aDestMainURL = aDest.GetMainURL(INetURLObject::DecodeMechanism::NONE); sal_uInt64 nAttributes = GetDefaultFileAttributes(aDestMainURL); - if (IsFileMovable(aDestMainURL) + if (IsFileMovable(aDest) && osl::File::replace(aSourceMainURL, aDestMainURL) == osl::FileBase::E_None) { if (nAttributes) |