Reverted an unneeded fix

loadfix
pvdk 11 years ago
parent 10d2ca82f7
commit 14b164a03d

@ -389,7 +389,7 @@ void Wizard::UnshieldWorker::extract()
// Write the settings to the Morrowind config file // Write the settings to the Morrowind config file
if (!writeSettings()) if (!writeSettings())
return false; return;
// Remove the temporary directory // Remove the temporary directory
removeDirectory(getPath() + QDir::separator() + QLatin1String("extract-temp")); removeDirectory(getPath() + QDir::separator() + QLatin1String("extract-temp"));
@ -453,18 +453,11 @@ bool Wizard::UnshieldWorker::setupComponent(Component component)
qDebug() << "current archive: " << file; qDebug() << "current archive: " << file;
// Try to open the archive
Unshield *unshield = NULL;
unshield = openCab(file);
if (!unshield)
return false;
if (component == Wizard::Component_Morrowind) if (component == Wizard::Component_Morrowind)
{ {
bool morrowindFound = findInCab(QLatin1String("Morrowind.bsa"), unshield); bool morrowindFound = findInCab(QLatin1String("Morrowind.bsa"), file);
bool tribunalFound = findInCab(QLatin1String("Tribunal.bsa"), unshield); bool tribunalFound = findInCab(QLatin1String("Tribunal.bsa"), file);
bool bloodmoonFound = findInCab(QLatin1String("Bloodmoon.bsa"), unshield); bool bloodmoonFound = findInCab(QLatin1String("Bloodmoon.bsa"), file);
if (morrowindFound) { if (morrowindFound) {
// Check if we have correct archive, other archives have Morrowind.bsa too // Check if we have correct archive, other archives have Morrowind.bsa too
@ -476,14 +469,12 @@ bool Wizard::UnshieldWorker::setupComponent(Component component)
} }
} else { } else {
if (findInCab(name + QLatin1String(".bsa"), unshield)) { if (findInCab(name + QLatin1String(".bsa"), file)) {
cabFile = file; cabFile = file;
found = true; found = true;
} }
} }
// Close the current archive
unshield_close(unshield);
} }
if (!found) { if (!found) {
@ -778,6 +769,7 @@ bool Wizard::UnshieldWorker::extractCab(const QString &cabFile, const QString &d
if (!unshield) { if (!unshield) {
emit error(tr("Failed to open InstallShield Cabinet File."), tr("Opening %1 failed.").arg(cabFile)); emit error(tr("Failed to open InstallShield Cabinet File."), tr("Opening %1 failed.").arg(cabFile));
unshield_close(unshield);
return false; return false;
} }
@ -878,7 +870,7 @@ QStringList Wizard::UnshieldWorker::findDirectories(const QString &dirName, cons
return findFiles(dirName, path, 0, true, true); return findFiles(dirName, path, 0, true, true);
} }
Unshield* Wizard::UnshieldWorker::openCab(const QString &cabFile) bool Wizard::UnshieldWorker::findInCab(const QString &fileName, const QString &cabFile)
{ {
QByteArray array(cabFile.toUtf8()); QByteArray array(cabFile.toUtf8());
@ -888,16 +880,8 @@ Unshield* Wizard::UnshieldWorker::openCab(const QString &cabFile)
if (!unshield) { if (!unshield) {
emit error(tr("Failed to open InstallShield Cabinet File."), tr("Opening %1 failed.").arg(cabFile)); emit error(tr("Failed to open InstallShield Cabinet File."), tr("Opening %1 failed.").arg(cabFile));
unshield_close(unshield); unshield_close(unshield);
return NULL;
}
return unshield;
}
bool Wizard::UnshieldWorker::findInCab(const QString &fileName, Unshield *unshield)
{
if (!unshield)
return false; return false;
}
for (int i=0; i<unshield_file_group_count(unshield); ++i) for (int i=0; i<unshield_file_group_count(unshield); ++i)
{ {

@ -63,8 +63,7 @@ namespace Wizard
bool extractCab(const QString &cabFile, const QString &destination); bool extractCab(const QString &cabFile, const QString &destination);
bool extractFile(Unshield *unshield, const QString &destination, const QString &prefix, int index, int counter); bool extractFile(Unshield *unshield, const QString &destination, const QString &prefix, int index, int counter);
Unshield* openCab(const QString &cabFile); bool findInCab(const QString &fileName, const QString &cabFile);
bool findInCab(const QString &fileName, Unshield *unshield);
QString findFile(const QString &fileName, const QString &path); QString findFile(const QString &fileName, const QString &path);

Loading…
Cancel
Save