Changeset View
Changeset View
Standalone View
Standalone View
src/core/installation.cpp
| Show First 20 Lines • Show All 517 Lines • ▼ Show 20 Line(s) | 515 | if (source.url().startsWith(QLatin1String("http://newstuff.kde.org/cgi-bin/hotstuff-access?file="))) { | |||
|---|---|---|---|---|---|
| 518 | if (lastSlash >= 0) { | 518 | if (lastSlash >= 0) { | ||
| 519 | installfile = installfile.mid(lastSlash); | 519 | installfile = installfile.mid(lastSlash); | ||
| 520 | } | 520 | } | ||
| 521 | } | 521 | } | ||
| 522 | if (installfile.isEmpty()) { | 522 | if (installfile.isEmpty()) { | ||
| 523 | installfile = source.fileName(); | 523 | installfile = source.fileName(); | ||
| 524 | } | 524 | } | ||
| 525 | } | 525 | } | ||
| 526 | QString installpath = installdir + QLatin1Char('/') + installfile; | 526 | QString installpath = QDir(installdir).filePath(installfile); | ||
| 527 | 527 | | |||
| 528 | qCDebug(KNEWSTUFFCORE) << "Install to file " << installpath; | 528 | qCDebug(KNEWSTUFFCORE) << "Install to file " << installpath; | ||
| 529 | // FIXME: copy goes here (including overwrite checking) | 529 | // FIXME: copy goes here (including overwrite checking) | ||
| 530 | // FIXME: what must be done now is to update the cache *again* | 530 | // FIXME: what must be done now is to update the cache *again* | ||
| 531 | // in order to set the new payload filename (on root tag only) | 531 | // in order to set the new payload filename (on root tag only) | ||
| 532 | // - this might or might not need to take uncompression into account | 532 | // - this might or might not need to take uncompression into account | ||
| 533 | // FIXME: for updates, we might need to force an overwrite (that is, deleting before) | 533 | // FIXME: for updates, we might need to force an overwrite (that is, deleting before) | ||
| 534 | QFile file(payloadfile); | 534 | QFile file(payloadfile); | ||
| ▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 600 | if (!uninstallCommand.isEmpty()) { | |||
| 601 | const auto lst = entry.installedFiles(); | 601 | const auto lst = entry.installedFiles(); | ||
| 602 | for (const QString &file : lst) { | 602 | for (const QString &file : lst) { | ||
| 603 | QFileInfo info(file); | 603 | QFileInfo info(file); | ||
| 604 | if (info.isFile()) { | 604 | if (info.isFile()) { | ||
| 605 | QString fileArg(KShell::quoteArg(file)); | 605 | QString fileArg(KShell::quoteArg(file)); | ||
| 606 | QString command(uninstallCommand); | 606 | QString command(uninstallCommand); | ||
| 607 | command.replace(QLatin1String("%f"), fileArg); | 607 | command.replace(QLatin1String("%f"), fileArg); | ||
| 608 | 608 | | |||
| 609 | int exitcode = QProcess::execute(command, QStringList()); | 609 | QStringList args = KShell::splitArgs(command); | ||
| 610 | const QString program = args.takeFirst(); | ||||
anthonyfieroni: Get program in exclusive line
```
auto program = args.takeFirst();
int exitcode = QProcess… | |||||
| 611 | int exitcode = QProcess::execute(program, args); | ||||
| 610 | 612 | | |||
| 611 | if (exitcode) { | 613 | if (exitcode) { | ||
| 612 | emit signalInstallationError(i18n("The uninstallation process failed to successfully run the command %1", command)); | 614 | emit signalInstallationError(i18n("The uninstallation process failed to successfully run the command %1", command)); | ||
| 613 | qCCritical(KNEWSTUFFCORE) << "Command failed" << command; | 615 | qCCritical(KNEWSTUFFCORE) << "Command failed" << command; | ||
| 614 | } else { | 616 | } else { | ||
| 615 | qCDebug(KNEWSTUFFCORE) << "Command executed successfully: " << command; | 617 | qCDebug(KNEWSTUFFCORE) << "Command executed successfully: " << command; | ||
| 616 | } | 618 | } | ||
| 617 | } | 619 | } | ||
| ▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines | |||||
Get program in exclusive line
The problem is args is modified at argument pass time, then second parameter expect it is. That's not guaranteed you should expect compiler to do the right thing.