void NewLanguagesController::downloadFinished(const QFileInfo destFile) { // if no "destFile" is assigned, we can ignore this signal if (destFile.absoluteFilePath().isEmpty()) return; // create languages directory QDir languagesDir; languagesDir.mkpath(programOptions->getLanguagesPath()); // unpack the downloaded file Unpacker *unpacker = new Unpacker; // install it directly to languages folder unpacker->extractPackage(destFile.filePath().toStdString(), QString(programOptions->getLanguagesPath() + "/").toStdString(), true); // check if we installed this language bool error = false; // check if all files has been extracted for (int n = 0; n < unpacker->getExtractedFilesCount(); n++) if (!error) // check if the extracted file exists error = !QFile::exists(QString(programOptions->getLanguagesPath() + "/" + QString().fromStdString(unpacker->getExtractedFileName(n, true)))); // destroy unpacker delete unpacker; // remove temporal fil QFile::remove(destFile.filePath()); // finish event emit afterInstallNewLanguage(currentLanguage, error); // reset flags currentLanguage = NULL; // reload all info fillInstalledLanguages(); updateNewLanguages(); }
int main(int argc, char ** argv) { std::cout << "--------------------------------------------" << std::endl << "Pakunpaker v1.0 by Xesc & Technology 2008-09" << std::endl << "--------------------------------------------" << std::endl << std::endl; if (argc > 2) { // create a new package if (strcmp(argv[1], "-i") == 0) { Packer *packer = new Packer; for (int param = 3; param < argc; param++) { packer->addFile(std::string(argv[param])); std::cout << "added: " << argv[param] << std::endl; } packer->buildPackage(argv[2]); std::cout << "Package build: " << argv[2] << std::endl; delete packer; } // extract files from package else if ((strcmp(argv[1], "-o") == 0 || strcmp(argv[1], "-oo") == 0) && argc == 4) { Unpacker *unpacker = new Unpacker; unpacker->extractPackage(std::string(argv[2]), std::string(argv[3]), strcmp(argv[1], "-o") == 0); for (int n = 0; n < unpacker->getExtractedFilesCount(); n++) std::cout << "Unpacked file " << n + 1 << " to: " << unpacker->getExtractedFileName(n) << std::endl; delete unpacker; } else // unknonw parameters displayHelp(); } else // invalid parameters displayHelp(); return 0; }