Browse Source

Forgot to use the new safeRemove() function at some places

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
ff08abe177
  1. 18
      src/engineselectdlg.cpp
  2. 2
      src/geoip.h
  3. 4
      src/rss.cpp
  4. 2
      src/torrentadditiondlg.cpp

18
src/engineselectdlg.cpp

@ -265,7 +265,7 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) { @@ -265,7 +265,7 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
if(QFile::exists(dest_path)) {
// Backup in case install fails
QFile::copy(dest_path, dest_path+".bak");
QFile::remove(dest_path);
misc::safeRemove(dest_path);
update = true;
}
// Copy the plugin
@ -276,22 +276,22 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) { @@ -276,22 +276,22 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
if(!supported_engines->contains(plugin_name)) {
if(update) {
// Remove broken file
QFile::remove(dest_path);
misc::safeRemove(dest_path);
// restore backup
QFile::copy(dest_path+".bak", dest_path);
QFile::remove(dest_path+".bak");
misc::safeRemove(dest_path+".bak");
QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be updated, keeping old version.", "%1 is the name of the search engine").arg(plugin_name));
return;
} else {
// Remove broken file
QFile::remove(dest_path);
misc::safeRemove(dest_path);
QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be installed.", "%1 is the name of the search engine").arg(plugin_name));
return;
}
}
// Install was successful, remove backup
if(update) {
QFile::remove(dest_path+".bak");
misc::safeRemove(dest_path+".bak");
}
if(update) {
QMessageBox::information(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin was successfully updated.", "%1 is the name of the search engine").arg(plugin_name));
@ -409,7 +409,7 @@ bool engineSelectDlg::parseVersionsFile(QString versions_file) { @@ -409,7 +409,7 @@ bool engineSelectDlg::parseVersionsFile(QString versions_file) {
// Close file
versions.close();
// Clean up tmp file
QFile::remove(versions_file);
misc::safeRemove(versions_file);
if(file_correct && !updated) {
QMessageBox::information(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("All your plugins are already up to date."));
}
@ -439,21 +439,21 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) { @@ -439,21 +439,21 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
}
}
// Delete tmp file
QFile::remove(filePath);
misc::safeRemove(filePath);
return;
}
if(url.endsWith("versions.txt")) {
if(!parseVersionsFile(filePath)) {
QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, update server is temporarily unavailable."));
}
QFile::remove(filePath);
misc::safeRemove(filePath);
return;
}
if(url.endsWith(".py", Qt::CaseInsensitive)) {
QString plugin_name = url.split('/').last();
plugin_name.replace(".py", "");
installPlugin(filePath, plugin_name);
QFile::remove(filePath);
misc::safeRemove(filePath);
return;
}
}

2
src/geoip.h

@ -76,7 +76,7 @@ protected: @@ -76,7 +76,7 @@ protected:
}
// Remove destination files
if(QFile::exists(geoipDBpath(false)))
QFile::remove(geoipDBpath(false));
misc::safeRemove(geoipDBpath(false));
// Copy from executable to hard disk
qDebug("%s -> %s", qPrintable(geoipDBpath(true)), qPrintable(geoipDBpath(false)));
if(!QFile::copy(geoipDBpath(true), geoipDBpath(false))) {

4
src/rss.cpp

@ -416,9 +416,9 @@ RssStream::~RssStream(){ @@ -416,9 +416,9 @@ RssStream::~RssStream(){
removeAllItems();
qDebug("All items were removed");
if(QFile::exists(filePath))
QFile::remove(filePath);
misc::safeRemove(filePath);
if(QFile::exists(iconPath) && !iconPath.startsWith(":/"))
QFile::remove(iconPath);
misc::safeRemove(iconPath);
}
RssFile::FileType RssStream::getType() const {

2
src/torrentadditiondlg.cpp

@ -187,7 +187,7 @@ void torrentAdditionDialog::showLoad(QString filePath, QString from_url) { @@ -187,7 +187,7 @@ void torrentAdditionDialog::showLoad(QString filePath, QString from_url) {
qDebug("Caught error loading torrent");
if(!from_url.isNull()){
BTSession->addConsoleMessage(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+from_url+QString::fromUtf8("'"), QString::fromUtf8("red"));
QFile::remove(filePath);
misc::safeRemove(filePath);
}else{
BTSession->addConsoleMessage(tr("Unable to decode torrent file:")+QString::fromUtf8(" '")+filePath+QString::fromUtf8("'"), QString::fromUtf8("red"));
}

Loading…
Cancel
Save