1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 16:29:43 +01:00

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

This commit is contained in:
Jeff Mitchell 2011-09-10 17:39:51 -04:00
parent 0a07750efb
commit 19da9ef754

View File

@ -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() ) ) );