From 65ffaf9f7dc21f7df786692614d06373c758cbb6 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Mon, 30 Jan 2012 16:30:44 +0100 Subject: [PATCH] fixed issue of empty document. In this case the metadata.rdf and the *.ubz are not created --- src/adaptors/UBMetadataDcSubsetAdaptor.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp index 145196e9..0dbdd5c5 100644 --- a/src/adaptors/UBMetadataDcSubsetAdaptor.cpp +++ b/src/adaptors/UBMetadataDcSubsetAdaptor.cpp @@ -68,12 +68,17 @@ UBMetadataDcSubsetAdaptor::~UBMetadataDcSubsetAdaptor() void UBMetadataDcSubsetAdaptor::persist(UBDocumentProxy* proxy) { + if(!QDir(proxy->persistencePath()).exists()){ + //In this case the a document is an empty document so we do not persist it + return; + } QString fileName = proxy->persistencePath() + "/" + metadataFilename; qWarning() << fileName; QFile file(fileName); if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { qCritical() << "cannot open " << fileName << " for writing ..."; + qCritical() << "error : " << file.errorString(); return; }