Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
Claudio Valerio 13 years ago
commit ce670e0d2a
  1. 65
      src/adaptors/UBImportCFF.cpp

@ -178,45 +178,32 @@ QString UBImportCFF::expandFileToDir(const QFile& pZipFile, const QString& pDir)
} }
QString newFileName = documentRootFolder + "/" + file.getActualFileName(); QString newFileName = documentRootFolder + "/" + file.getActualFileName();
bool ends = newFileName.endsWith('/');
if (!ends) { QFileInfo newFileInfo(newFileName);
rootDir.mkpath(newFileInfo.absolutePath());
QFileInfo newFileInfo(newFileName);
rootDir.mkpath(newFileInfo.absolutePath()); out.setFileName(newFileName);
out.open(QIODevice::WriteOnly);
out.setFileName(newFileName);
out.open(QIODevice::WriteOnly); while(file.getChar(&c))
out.putChar(c);
// Slow like hell (on GNU/Linux at least), but it is not my fault.
// Not ZIP/UNZIP package's fault either. out.close();
// The slowest thing here is out.putChar(c).
QByteArray outFileContent = file.readAll(); if(file.getZipError()!=UNZ_OK) {
if (out.write(outFileContent) == -1) qWarning() << "Import failed. Cause: " << zip.getZipError();
{ return "";
qWarning() << "Import failed. Cause: Unable to write file"; }
out.close(); if(!file.atEnd()) {
return ""; qWarning() << "Import failed. Cause: read all but not EOF";
} return "";
while(file.getChar(&c)) }
out.putChar(c);
file.close();
out.close();
if(file.getZipError()!=UNZ_OK) {
if(file.getZipError()!=UNZ_OK) { qWarning() << "Import failed. Cause: file.close(): " << file.getZipError();
qWarning() << "Import failed. Cause: " << zip.getZipError(); return "";
return "";
}
if(!file.atEnd()) {
qWarning() << "Import failed. Cause: read all but not EOF";
return "";
}
file.close();
if(file.getZipError()!=UNZ_OK) {
qWarning() << "Import failed. Cause: file.close(): " << file.getZipError();
return "";
}
} }
} }

Loading…
Cancel
Save