| 27 | } |
| 28 | |
| 29 | bool ExtractZipFile(zlib::FileToRead &zip, const QString path) { |
| 30 | constexpr auto kMaxSize = 25 * 1024 * 1024; |
| 31 | const auto content = zip.readCurrentFileContent(kMaxSize); |
| 32 | if (content.isEmpty() || zip.error() != UNZ_OK) { |
| 33 | return false; |
| 34 | } |
| 35 | auto file = QFile(path); |
| 36 | return file.open(QIODevice::WriteOnly) |
| 37 | && (file.write(content) == content.size()); |
| 38 | } |
| 39 | |
| 40 | } // namespace |
| 41 |