mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02: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:
@@ -36,8 +36,6 @@ using namespace Tomahawk;
|
|||||||
void
|
void
|
||||||
DatabaseCommand_DeleteFiles::postCommitHook()
|
DatabaseCommand_DeleteFiles::postCommitHook()
|
||||||
{
|
{
|
||||||
// qDebug() << Q_FUNC_INFO;
|
|
||||||
|
|
||||||
if ( !m_files.count() )
|
if ( !m_files.count() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -66,7 +64,7 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
|||||||
TomahawkSqlQuery delquery = dbi->newquery();
|
TomahawkSqlQuery delquery = dbi->newquery();
|
||||||
QString lastPath;
|
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;
|
qDebug() << "Deleting" << m_dir.path() << "from db for localsource" << srcid;
|
||||||
TomahawkSqlQuery dirquery = dbi->newquery();
|
TomahawkSqlQuery dirquery = dbi->newquery();
|
||||||
@@ -110,7 +108,7 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
|||||||
deleted++;
|
deleted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if ( !m_ids.isEmpty() && source()->isLocal() )
|
||||||
{
|
{
|
||||||
delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND url = ?" )
|
delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND url = ?" )
|
||||||
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) );
|
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) );
|
||||||
|
Reference in New Issue
Block a user