mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-06 23:52:31 -06:00
Remove misc::safeRemove(): shouldn't be needed
This commit is contained in:
@@ -243,8 +243,8 @@ 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");
|
||||
misc::safeRemove(dest_path);
|
||||
misc::safeRemove(dest_path+"c");
|
||||
QFile::remove(dest_path);
|
||||
QFile::remove(dest_path+"c");
|
||||
update = true;
|
||||
}
|
||||
// Copy the plugin
|
||||
@@ -255,22 +255,22 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
|
||||
if(!supported_engines->contains(plugin_name)) {
|
||||
if(update) {
|
||||
// Remove broken file
|
||||
misc::safeRemove(dest_path);
|
||||
QFile::remove(dest_path);
|
||||
// restore backup
|
||||
QFile::copy(dest_path+".bak", dest_path);
|
||||
misc::safeRemove(dest_path+".bak");
|
||||
QFile::remove(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
|
||||
misc::safeRemove(dest_path);
|
||||
QFile::remove(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) {
|
||||
misc::safeRemove(dest_path+".bak");
|
||||
QFile::remove(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));
|
||||
@@ -388,7 +388,7 @@ bool engineSelectDlg::parseVersionsFile(QString versions_file) {
|
||||
// Close file
|
||||
versions.close();
|
||||
// Clean up tmp file
|
||||
misc::safeRemove(versions_file);
|
||||
QFile::remove(versions_file);
|
||||
if(file_correct && !updated) {
|
||||
QMessageBox::information(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("All your plugins are already up to date."));
|
||||
}
|
||||
@@ -418,21 +418,21 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
|
||||
}
|
||||
}
|
||||
// Delete tmp file
|
||||
misc::safeRemove(filePath);
|
||||
QFile::remove(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."));
|
||||
}
|
||||
misc::safeRemove(filePath);
|
||||
QFile::remove(filePath);
|
||||
return;
|
||||
}
|
||||
if(url.endsWith(".py", Qt::CaseInsensitive)) {
|
||||
QString plugin_name = misc::fileName(url);
|
||||
plugin_name.chop(3); // Remove extension
|
||||
installPlugin(filePath, plugin_name);
|
||||
misc::safeRemove(filePath);
|
||||
QFile::remove(filePath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ void SearchEngine::pythonDownloadSuccess(QString url, QString file_path) {
|
||||
on_search_button_clicked();
|
||||
}
|
||||
// Delete temp file
|
||||
misc::safeRemove(file_path+".msi");
|
||||
QFile::remove(file_path+".msi");
|
||||
}
|
||||
|
||||
void SearchEngine::pythonDownloadFailure(QString url, QString error) {
|
||||
@@ -500,8 +500,8 @@ void SearchEngine::updateNova() {
|
||||
QString filePath = search_dir.absoluteFilePath("nova2.py");
|
||||
if(getPluginVersion(":/"+nova_folder+"/nova2.py") > getPluginVersion(filePath)) {
|
||||
if(QFile::exists(filePath)) {
|
||||
misc::safeRemove(filePath);
|
||||
misc::safeRemove(filePath+"c");
|
||||
QFile::remove(filePath);
|
||||
QFile::remove(filePath+"c");
|
||||
}
|
||||
QFile::copy(":/"+nova_folder+"/nova2.py", filePath);
|
||||
}
|
||||
@@ -509,8 +509,8 @@ void SearchEngine::updateNova() {
|
||||
filePath = search_dir.absoluteFilePath("nova2dl.py");
|
||||
if(getPluginVersion(":/"+nova_folder+"/nova2dl.py") > getPluginVersion(filePath)) {
|
||||
if(QFile::exists(filePath)){
|
||||
misc::safeRemove(filePath);
|
||||
misc::safeRemove(filePath+"c");
|
||||
QFile::remove(filePath);
|
||||
QFile::remove(filePath+"c");
|
||||
}
|
||||
QFile::copy(":/"+nova_folder+"/nova2dl.py", filePath);
|
||||
}
|
||||
@@ -518,8 +518,8 @@ void SearchEngine::updateNova() {
|
||||
filePath = search_dir.absoluteFilePath("novaprinter.py");
|
||||
if(getPluginVersion(":/"+nova_folder+"/novaprinter.py") > getPluginVersion(filePath)) {
|
||||
if(QFile::exists(filePath)){
|
||||
misc::safeRemove(filePath);
|
||||
misc::safeRemove(filePath+"c");
|
||||
QFile::remove(filePath);
|
||||
QFile::remove(filePath+"c");
|
||||
}
|
||||
QFile::copy(":/"+nova_folder+"/novaprinter.py", filePath);
|
||||
}
|
||||
@@ -527,24 +527,24 @@ void SearchEngine::updateNova() {
|
||||
filePath = search_dir.absoluteFilePath("helpers.py");
|
||||
if(getPluginVersion(":/"+nova_folder+"/helpers.py") > getPluginVersion(filePath)) {
|
||||
if(QFile::exists(filePath)){
|
||||
misc::safeRemove(filePath);
|
||||
misc::safeRemove(filePath+"c");
|
||||
QFile::remove(filePath);
|
||||
QFile::remove(filePath+"c");
|
||||
}
|
||||
QFile::copy(":/"+nova_folder+"/helpers.py", filePath);
|
||||
}
|
||||
|
||||
filePath = search_dir.absoluteFilePath("socks.py");
|
||||
if(QFile::exists(filePath)){
|
||||
misc::safeRemove(filePath);
|
||||
misc::safeRemove(filePath+"c");
|
||||
QFile::remove(filePath);
|
||||
QFile::remove(filePath+"c");
|
||||
}
|
||||
QFile::copy(":/"+nova_folder+"/socks.py", filePath);
|
||||
|
||||
if (nova_folder == "nova3") {
|
||||
filePath = search_dir.absoluteFilePath("sgmllib3.py");
|
||||
if(QFile::exists(filePath)){
|
||||
misc::safeRemove(filePath);
|
||||
misc::safeRemove(filePath+"c");
|
||||
QFile::remove(filePath);
|
||||
QFile::remove(filePath+"c");
|
||||
}
|
||||
QFile::copy(":/"+nova_folder+"/sgmllib3.py", filePath);
|
||||
}
|
||||
@@ -560,8 +560,8 @@ void SearchEngine::updateNova() {
|
||||
qDebug("shipped %s is more recent then local plugin, updating...", qPrintable(file));
|
||||
if(QFile::exists(dest_file)) {
|
||||
qDebug("Removing old %s", qPrintable(dest_file));
|
||||
misc::safeRemove(dest_file);
|
||||
misc::safeRemove(dest_file+"c");
|
||||
QFile::remove(dest_file);
|
||||
QFile::remove(dest_file+"c");
|
||||
}
|
||||
qDebug("%s copied to %s", qPrintable(shipped_file), qPrintable(dest_file));
|
||||
QFile::copy(shipped_file, dest_file);
|
||||
|
||||
Reference in New Issue
Block a user