Fix bug. QTemporaryFile blocks a file on Windows.
--HG-- branch : develop
This commit is contained in:
parent
06b567fa55
commit
a740d52861
|
@ -84,7 +84,6 @@ QString VAbstractConverter::Convert()
|
|||
const QString errorMsg(tr("Error openning a temp file file: %1.").arg(m_tmpFile.errorString()));
|
||||
throw VException(errorMsg);
|
||||
}
|
||||
m_tmpFile.close();
|
||||
|
||||
m_ver < MaxVer() ? ApplyPatches() : DowngradeToCurrentMaxVersion();
|
||||
|
||||
|
@ -256,23 +255,6 @@ Q_NORETURN void VAbstractConverter::InvalidVersion(int ver) const
|
|||
throw VException(errorMsg);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstractConverter::SaveDocument(const QString &fileName, QString &error) const
|
||||
{
|
||||
try
|
||||
{
|
||||
TestUniqueId();
|
||||
}
|
||||
catch (const VExceptionWrongId &e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
error = tr("Error no unique id.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return VDomDocument::SaveDocument(fileName, error);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractConverter::ValidateInputFile(const QString ¤tSchema) const
|
||||
{
|
||||
|
@ -311,12 +293,28 @@ void VAbstractConverter::ValidateInputFile(const QString ¤tSchema) const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractConverter::Save() const
|
||||
void VAbstractConverter::Save()
|
||||
{
|
||||
QString error;
|
||||
if (SaveDocument(m_convertedFileName, error) == false)
|
||||
try
|
||||
{
|
||||
VException e(error);
|
||||
TestUniqueId();
|
||||
}
|
||||
catch (const VExceptionWrongId &e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
VException ex(tr("Error no unique id."));
|
||||
throw ex;
|
||||
}
|
||||
|
||||
m_tmpFile.resize(0);//clear previous content
|
||||
const int indent = 4;
|
||||
QTextStream out(&m_tmpFile);
|
||||
out.setCodec("UTF-8");
|
||||
save(out, indent);
|
||||
|
||||
if (not m_tmpFile.flush())
|
||||
{
|
||||
VException e(m_tmpFile.errorString());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,6 @@ public:
|
|||
virtual ~VAbstractConverter() Q_DECL_OVERRIDE;
|
||||
|
||||
QString Convert();
|
||||
virtual bool SaveDocument(const QString &fileName, QString &error) const Q_DECL_OVERRIDE;
|
||||
|
||||
static int GetVersion(const QString &version);
|
||||
|
||||
|
@ -62,10 +61,9 @@ protected:
|
|||
int m_ver;
|
||||
QString m_convertedFileName;
|
||||
|
||||
|
||||
void ValidateInputFile(const QString ¤tSchema) const;
|
||||
Q_NORETURN void InvalidVersion(int ver) const;
|
||||
void Save() const;
|
||||
void Save();
|
||||
void SetVersion(const QString &version);
|
||||
|
||||
virtual int MinVer() const =0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user