mirror of
https://github.com/ONLYOFFICE/desktop-sdk.git
synced 2026-03-31 10:23:12 +08:00
Fix bug 31191
This commit is contained in:
@ -501,6 +501,11 @@ namespace NSSystem
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsEmpty()
|
||||
{
|
||||
return m_pLocker->IsEmpty();
|
||||
}
|
||||
|
||||
~CLocalFileLocker()
|
||||
{
|
||||
Unlock();
|
||||
|
||||
@ -2881,6 +2881,16 @@ public:
|
||||
|
||||
bool bIsSaveAs = (sParams.find("saveas=true") != std::string::npos) ? true : false;
|
||||
|
||||
if (!bIsNeedSave)
|
||||
{
|
||||
if (m_pParent->m_pInternal->m_pLocalFileLocker &&
|
||||
m_pParent->m_pInternal->m_pLocalFileLocker->IsEmpty() &&
|
||||
!NSFile::CFileBinary::Exists(m_pParent->m_pInternal->m_oLocalInfo.m_oInfo.m_sFileSrc))
|
||||
{
|
||||
bIsNeedSave = true;
|
||||
}
|
||||
}
|
||||
|
||||
// нужно ли показывать диалог?
|
||||
// 1) файл новый/восстановленный, т.е. некуда пока сохранять
|
||||
// 2) saveAs
|
||||
|
||||
@ -240,6 +240,18 @@ namespace NSSystem
|
||||
|
||||
virtual bool WriteFile(const void* pData, DWORD dwBytesToWrite, DWORD& dwSizeWrite)
|
||||
{
|
||||
if (!NSFile::CFileBinary::Exists(m_sFile))
|
||||
{
|
||||
Unlock();
|
||||
std::wstring sDirectory = NSFile::GetDirectoryName(m_sFile);
|
||||
NSDirectory::CreateDirectories(sDirectory);
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFile(m_sFile);
|
||||
oFile.CloseFile();
|
||||
|
||||
Lock();
|
||||
}
|
||||
bool bResult = false;
|
||||
if ( m_nDescriptor != -1 )
|
||||
{
|
||||
@ -248,6 +260,11 @@ namespace NSSystem
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
|
||||
virtual bool IsEmpty()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class CFileLockerFCNTL : public CFileLockerEmpty
|
||||
@ -546,6 +563,11 @@ namespace NSSystem
|
||||
{
|
||||
}
|
||||
|
||||
bool CFileLocker::IsEmpty()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CFileLocker::IsHandled(const std::wstring& file)
|
||||
{
|
||||
return CHandlesMonitor::Instance().IsExist(file);
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
#define FILELOCKER_H
|
||||
|
||||
#include <iostream>
|
||||
#include "../../../../core/DesktopEditor/common/File.h"
|
||||
#include "../../../../core/DesktopEditor/common/Directory.h"
|
||||
#include "../../../../core/DesktopEditor/common/Types.h"
|
||||
|
||||
namespace NSSystem
|
||||
@ -62,6 +62,8 @@ namespace NSSystem
|
||||
virtual bool Truncate(DWORD dwPosition) = 0;
|
||||
virtual bool WriteFile(const void* pData, DWORD dwBytesToWrite, DWORD& dwSizeWrite) = 0;
|
||||
|
||||
virtual bool IsEmpty();
|
||||
|
||||
static LockType IsLocked(const std::wstring& file);
|
||||
static CFileLocker* Create(const std::wstring& file);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user