diff --git a/src/engineselectdlg.cpp b/src/engineselectdlg.cpp index d669a69a6..9a9543702 100644 --- a/src/engineselectdlg.cpp +++ b/src/engineselectdlg.cpp @@ -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) { 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) { // 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) { } } // 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; } } diff --git a/src/geoip.h b/src/geoip.h index b25cd64ee..7a426cf45 100644 --- a/src/geoip.h +++ b/src/geoip.h @@ -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))) { diff --git a/src/rss.cpp b/src/rss.cpp index bc54fc3d6..debc006f9 100644 --- a/src/rss.cpp +++ b/src/rss.cpp @@ -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 { diff --git a/src/torrentadditiondlg.cpp b/src/torrentadditiondlg.cpp index a407a497f..6c1b898c8 100644 --- a/src/torrentadditiondlg.cpp +++ b/src/torrentadditiondlg.cpp @@ -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")); }