@ -793,7 +793,7 @@ void QBtSession::deleteTorrent(const QString &hash, bool delete_local_files) {
@@ -793,7 +793,7 @@ void QBtSession::deleteTorrent(const QString &hash, bool delete_local_files) {
// Remove unneeded and incomplete files
foreach ( const QString & uneeded_file , uneeded_files ) {
qDebug ( " Removing uneeded file: %s " , qPrintable ( uneeded_file ) ) ;
misc : : safeR emove( uneeded_file ) ;
QFile : : r emove( uneeded_file ) ;
const QString parent_folder = misc : : branchPath ( uneeded_file ) ;
qDebug ( " Attempt to remove parent folder (if empty): %s " , qPrintable ( parent_folder ) ) ;
misc : : removeEmptyFolder ( parent_folder ) ;
@ -805,7 +805,7 @@ void QBtSession::deleteTorrent(const QString &hash, bool delete_local_files) {
@@ -805,7 +805,7 @@ void QBtSession::deleteTorrent(const QString &hash, bool delete_local_files) {
filters < < hash + " .* " ;
const QStringList files = torrentBackup . entryList ( filters , QDir : : Files , QDir : : Unsorted ) ;
foreach ( const QString & file , files ) {
misc : : safeR emove( torrentBackup . absoluteFilePath ( file ) ) ;
QFile : : r emove( torrentBackup . absoluteFilePath ( file ) ) ;
}
TorrentPersistentData : : deletePersistentData ( hash ) ;
// Remove tracker errors
@ -1005,7 +1005,7 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
@@ -1005,7 +1005,7 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
addConsoleMessage ( tr ( " Unable to decode torrent file: '%1' " , " e.g: Unable to decode torrent file: '/home/y/xxx.torrent' " ) . arg ( from_url ) , QString : : fromUtf8 ( " red " ) ) ;
addConsoleMessage ( QString : : fromLocal8Bit ( e . what ( ) ) , " red " ) ;
//emit invalidTorrent(from_url);
misc : : safeR emove( path ) ;
QFile : : r emove( path ) ;
} else {
# if defined(Q_WS_WIN) || defined(Q_OS_OS2)
QString displayed_path = path ;
@ -1019,7 +1019,7 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
@@ -1019,7 +1019,7 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
addConsoleMessage ( tr ( " This file is either corrupted or this isn't a torrent. " ) , QString : : fromUtf8 ( " red " ) ) ;
if ( fromScanDir ) {
// Remove file
misc : : safeR emove( path ) ;
QFile : : r emove( path ) ;
}
return h ;
}
@ -1050,7 +1050,8 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
@@ -1050,7 +1050,8 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
mergeTorrents ( h_ex , t ) ;
// Delete file if temporary
if ( ! from_url . isNull ( ) | | fromScanDir ) misc : : safeRemove ( path ) ;
if ( ! from_url . isNull ( ) | | fromScanDir )
QFile : : remove ( path ) ;
return h ;
}
@ -1058,7 +1059,8 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
@@ -1058,7 +1059,8 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
if ( t - > num_files ( ) < 1 ) {
addConsoleMessage ( tr ( " Error: The torrent %1 does not contain any file. " ) . arg ( misc : : toQStringU ( t - > name ( ) ) ) ) ;
// Delete file if temporary
if ( ! from_url . isNull ( ) | | fromScanDir ) misc : : safeRemove ( path ) ;
if ( ! from_url . isNull ( ) | | fromScanDir )
QFile : : remove ( path ) ;
return h ;
}
@ -1135,7 +1137,8 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
@@ -1135,7 +1137,8 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
// Check if it worked
if ( ! h . is_valid ( ) ) {
qDebug ( " /! \\ Error: Invalid handle " ) ;
if ( ! from_url . isNull ( ) ) misc : : safeRemove ( path ) ;
if ( ! from_url . isNull ( ) )
QFile : : remove ( path ) ;
return h ;
}
// Remember root folder
@ -1180,7 +1183,8 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
@@ -1180,7 +1183,8 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
}
// If temporary file, remove it
if ( ! from_url . isNull ( ) | | fromScanDir ) misc : : safeRemove ( path ) ;
if ( ! from_url . isNull ( ) | | fromScanDir )
QFile : : remove ( path ) ;
// Display console message
if ( ! from_url . isNull ( ) ) {
@ -1496,7 +1500,7 @@ void QBtSession::loadSessionState() {
@@ -1496,7 +1500,7 @@ void QBtSession::loadSessionState() {
if ( ! QFile : : exists ( state_path ) ) return ;
if ( QFile ( state_path ) . size ( ) = = 0 ) {
// Remove empty invalid state file
misc : : safeR emove( state_path ) ;
QFile : : r emove( state_path ) ;
return ;
}
# if LIBTORRENT_VERSION_MINOR > 14
@ -1700,7 +1704,7 @@ void QBtSession::saveFastResumeData() {
@@ -1700,7 +1704,7 @@ void QBtSession::saveFastResumeData() {
const QString filepath = torrentBackup . absoluteFilePath ( h . hash ( ) + " .fastresume " ) ;
QFile resume_file ( filepath ) ;
if ( resume_file . exists ( ) )
misc : : safeR emove( filepath ) ;
QFile : : r emove( filepath ) ;
if ( ! out . empty ( ) & & resume_file . open ( QIODevice : : WriteOnly ) ) {
resume_file . write ( & out [ 0 ] , out . size ( ) ) ;
resume_file . close ( ) ;
@ -2302,7 +2306,7 @@ void QBtSession::readAlerts() {
@@ -2302,7 +2306,7 @@ void QBtSession::readAlerts() {
const QString filepath = torrentBackup . absoluteFilePath ( h . hash ( ) + " .fastresume " ) ;
QFile resume_file ( filepath ) ;
if ( resume_file . exists ( ) )
misc : : safeR emove( filepath ) ;
QFile : : r emove( filepath ) ;
qDebug ( " Saving fastresume data in %s " , qPrintable ( filepath ) ) ;
vector < char > out ;
bencode ( back_inserter ( out ) , * p - > resume_data ) ;