From 19da9ef75454b9a1992ad5cd91b2f5bf08bbd8e2 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Sat, 10 Sep 2011 17:39:51 -0400 Subject: [PATCH] Properly check for empty directory so the right code path for deleting individual files on scan is hit...doesn't fix update problems though, but at least the right file urls are now making it to Collection::deleteTracks --- src/libtomahawk/database/databasecommand_deletefiles.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libtomahawk/database/databasecommand_deletefiles.cpp b/src/libtomahawk/database/databasecommand_deletefiles.cpp index c8ecda316..62b177c31 100644 --- a/src/libtomahawk/database/databasecommand_deletefiles.cpp +++ b/src/libtomahawk/database/databasecommand_deletefiles.cpp @@ -36,8 +36,6 @@ using namespace Tomahawk; void DatabaseCommand_DeleteFiles::postCommitHook() { -// qDebug() << Q_FUNC_INFO; - if ( !m_files.count() ) return; @@ -66,7 +64,7 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi ) TomahawkSqlQuery delquery = dbi->newquery(); QString lastPath; - if ( !m_dir.path().isEmpty() && source()->isLocal() ) + if ( m_dir.path() != QString( "." ) && source()->isLocal() ) { qDebug() << "Deleting" << m_dir.path() << "from db for localsource" << srcid; TomahawkSqlQuery dirquery = dbi->newquery(); @@ -110,7 +108,7 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi ) deleted++; } } - else + else if ( !m_ids.isEmpty() && source()->isLocal() ) { delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND url = ?" ) .arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) );