Merge with develop

--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2016-10-18 10:27:44 +02:00
commit 0238b30489
4 changed files with 23 additions and 6 deletions

View file

@ -983,7 +983,19 @@ OperationStep CConfigFile::getInstallNextStep() const
case -1: return LaunchInstalledInstaller; case -1: return LaunchInstalledInstaller;
// continue only if 0 and launched Installer is the installed one // continue only if 0 and launched Installer is the installed one
default: if (getInstallerCurrentFilePath() != getInstallerInstalledFilePath() && QFile::exists(getInstallerInstalledFilePath())) return LaunchInstalledInstaller; default:
{
#ifdef Q_OS_WIN32
QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
// check if launched from TEMP directory
bool rightPath = getInstallerCurrentDirPath().startsWith(tempPath);
#else
bool rightPath = false;
#endif
if (!rightPath && getInstallerCurrentFilePath() != getInstallerInstalledFilePath() && QFile::exists(getInstallerInstalledFilePath())) return LaunchInstalledInstaller;
}
} }
// no default profile // no default profile

View file

@ -448,8 +448,6 @@ bool CFilesExtractor::extract7z()
// errors only occur when returned size is -1 // errors only occur when returned size is -1
if (currentProcessedSize < 0) if (currentProcessedSize < 0)
{ {
error = QApplication::tr("Unable to write output file %1").arg(destPath);
res = SZ_ERROR_FAIL;
break; break;
} }
@ -458,6 +456,13 @@ bool CFilesExtractor::extract7z()
} }
while (currentSizeToProcess > 0); while (currentSizeToProcess > 0);
if (offset != outSizeProcessed)
{
error = QApplication::tr("Unable to write output file %1 (%2 bytes written but expecting %3 bytes)").arg(destPath).arg(offset).arg(outSizeProcessed);
res = SZ_ERROR_FAIL;
break;
}
outFile.close(); outFile.close();
totalUncompressed += SzArEx_GetFileSize(&db, i); totalUncompressed += SzArEx_GetFileSize(&db, i);

View file

@ -157,7 +157,7 @@ int main(int argc, char *argv[])
QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation); QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
// check if launched from TEMP directory // check if launched from TEMP directory
if (step == Done && !QApplication::applicationDirPath().startsWith(tempPath)) if (step == Done && !config.getInstallerCurrentDirPath().startsWith(tempPath))
{ {
// try to delete all temporary installers // try to delete all temporary installers
QDir tempDir(tempPath); QDir tempDir(tempPath);
@ -263,7 +263,7 @@ int main(int argc, char *argv[])
{ {
#if defined(Q_OS_WIN) && !defined(_DEBUG) #if defined(Q_OS_WIN) && !defined(_DEBUG)
// restart Installer, so it could be copied in TEMP and allowed to update itself // restart Installer, so it could be copied in TEMP and allowed to update itself
if (QProcess::startDetached(QApplication::applicationFilePath())) return 0; if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0;
#endif #endif
} }
} }