mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-19 12:21:52 +02:00
* Use canonicalPath() wherever dealing with file- & dir-paths.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -78,18 +78,18 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
|||||||
delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND id = ?" )
|
delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND id = ?" )
|
||||||
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) );
|
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) );
|
||||||
|
|
||||||
dirquery.bindValue( 0, "file://" + m_dir.absolutePath() + "/%" );
|
dirquery.bindValue( 0, "file://" + m_dir.canonicalPath() + "/%" );
|
||||||
dirquery.exec();
|
dirquery.exec();
|
||||||
|
|
||||||
while ( dirquery.next() )
|
while ( dirquery.next() )
|
||||||
{
|
{
|
||||||
QFileInfo fi( dirquery.value( 1 ).toString().mid( 7 ) ); // remove file://
|
QFileInfo fi( dirquery.value( 1 ).toString().mid( 7 ) ); // remove file://
|
||||||
if ( fi.absolutePath() != m_dir.absolutePath() )
|
if ( fi.canonicalPath() != m_dir.canonicalPath() )
|
||||||
{
|
{
|
||||||
if ( lastPath != fi.absolutePath() )
|
if ( lastPath != fi.canonicalPath() )
|
||||||
qDebug() << "Skipping subdir:" << fi.absolutePath();
|
qDebug() << "Skipping subdir:" << fi.canonicalPath();
|
||||||
|
|
||||||
lastPath = fi.absolutePath();
|
lastPath = fi.canonicalPath();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,11 +133,11 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
|||||||
<< delquery.boundValues();
|
<< delquery.boundValues();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
deleted++;
|
deleted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Deleted" << deleted << m_ids << m_files;
|
qDebug() << "Deleted" << deleted << m_ids << m_files;
|
||||||
|
|
||||||
emit done( m_files, source()->collection() );
|
emit done( m_files, source()->collection() );
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -60,7 +60,7 @@ DatabaseCommand_DirMtimes::execSelectPath( DatabaseImpl *dbi, const QDir& path,
|
|||||||
"FROM dirs_scanned "
|
"FROM dirs_scanned "
|
||||||
"WHERE name LIKE :prefix" ) );
|
"WHERE name LIKE :prefix" ) );
|
||||||
|
|
||||||
query.bindValue( ":prefix", path.absolutePath() + "%" );
|
query.bindValue( ":prefix", path.canonicalPath() + "%" );
|
||||||
query.exec();
|
query.exec();
|
||||||
|
|
||||||
while( query.next() )
|
while( query.next() )
|
||||||
|
Reference in New Issue
Block a user