1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-22 20:44:15 +00:00

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

This commit is contained in:
Christophe Dumez 2010-07-25 15:26:27 +00:00
parent 159be479cc
commit ff08abe177
4 changed files with 13 additions and 13 deletions

View File

@ -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;
}
}

View File

@ -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))) {

View File

@ -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 {

View File

@ -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"));
}