From 9c31cfa915f71adee8579aa97c12b64903ec9446 Mon Sep 17 00:00:00 2001 From: Tannin Date: Fri, 30 Aug 2013 20:59:12 +0200 Subject: - the download manager now registers download speed. Right now this is only used to display an average speed on the settings menu - added a python27.dll compiled with vc100. This can now be bundled without introducing more dependencies - bugfix: extracting now stops after an error - bugfix: the way hook.dll caused CREATE_ALWAYS/CREATE_NEW to always write into overwrite could lead to the file being created when the call should have failed (because the file existed and was protected) - bugfix: GetPrivateProfileString does NOT properly report files as missing. This means that the ini-query optimization could optimize away requests that should work - bugfix: fomod installer couldn't display images because they were unpacked to the wrong temporary location - bugfix: When disabling local saves and choosing to delete the saves nothing happened - bugfix: the python plugin couldn't find the pyqt libraries --- src/installationmanager.cpp | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'src/installationmanager.cpp') diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index a6d86f36..5d00142d 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -114,7 +114,8 @@ void InstallationManager::mapToArchive(const DirectoryTree::Node *node, std::wst for (DirectoryTree::const_node_iterator iter = node->nodesBegin(); iter != node->nodesEnd(); ++iter) { if ((*iter)->getData().index != -1) { data[(*iter)->getData().index]->setSkip(false); - data[(*iter)->getData().index]->setOutputFileName(path.substr().append(ToWString((*iter)->getData().name)).c_str()); + std::wstring temp = path.substr().append(ToWString((*iter)->getData().name)); + data[(*iter)->getData().index]->setOutputFileName(temp.c_str()); } mapToArchive(*iter, path.substr().append(ToWString((*iter)->getData().name)), data); } @@ -151,6 +152,7 @@ bool InstallationManager::unpackSingleFile(const QString &fileName) if (_wcsicmp(data[i]->getFileName(), ToWString(fileName).c_str()) == 0) { available = true; data[i]->setSkip(false); +qDebug("usf %ls -> %s", data[i]->getFileName(), qPrintable(baseName)); data[i]->setOutputFileName(ToWString(baseName).c_str()); m_TempFilesToDelete.insert(baseName); } else { @@ -206,7 +208,7 @@ QString canonicalize(const QString &name) } -QStringList InstallationManager::extractFiles(const QStringList &filesOrig) +QStringList InstallationManager::extractFiles(const QStringList &filesOrig, bool flatten) { QStringList files; @@ -222,20 +224,26 @@ QStringList InstallationManager::extractFiles(const QStringList &filesOrig) for (size_t i = 0; i < size; ++i) { if (files.contains(ToQString(data[i]->getFileName()), Qt::CaseInsensitive)) { - const wchar_t *baseName = wcsrchr(data[i]->getFileName(), '\\'); - if (baseName == NULL) { - baseName = wcsrchr(data[i]->getFileName(), '/'); - } - if (baseName == NULL) { - qCritical("failed to find backslash in %ls", data[i]->getFileName()); - continue; + const wchar_t *targetFile = data[i]->getFileName(); + if (flatten) { + targetFile = wcsrchr(data[i]->getFileName(), '\\'); + if (targetFile == NULL) { + targetFile = wcsrchr(data[i]->getFileName(), '/'); + } + if (targetFile == NULL) { + qCritical("failed to find backslash in %ls", data[i]->getFileName()); + continue; + } else { + // skip the slash + ++targetFile; + } } - data[i]->setOutputFileName(baseName); + data[i]->setOutputFileName(targetFile); - result.append(QDir::tempPath().append("/").append(ToQString(baseName))); + result.append(QDir::tempPath().append("/").append(ToQString(targetFile))); data[i]->setSkip(false); - m_TempFilesToDelete.insert(ToQString(baseName)); + m_TempFilesToDelete.insert(ToQString(targetFile)); } else { data[i]->setSkip(true); } @@ -252,6 +260,7 @@ QStringList InstallationManager::extractFiles(const QStringList &filesOrig) new MethodCallback(this, &InstallationManager::updateProgress), new MethodCallback(this, &InstallationManager::dummyProgressFile), new MethodCallback(this, &InstallationManager::report7ZipError))) { + m_InstallationProgress.hide(); throw std::runtime_error("extracting failed"); } @@ -401,6 +410,7 @@ void InstallationManager::report7ZipError(LPCWSTR errorMessage) #else reportError(QString::fromUtf16(errorMessage)); #endif + m_CurrentArchive->cancel(); } @@ -527,6 +537,7 @@ bool InstallationManager::doInstall(GuessedValue &modName, int modID, new MethodCallback(this, &InstallationManager::updateProgress), new MethodCallback(this, &InstallationManager::updateProgressFile), new MethodCallback(this, &InstallationManager::report7ZipError))) { + m_InstallationProgress.hide(); if (m_CurrentArchive->getLastError() == Archive::ERROR_EXTRACT_CANCELLED) { return false; } else { -- cgit v1.3.1