1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-18 20:04:00 +02:00

* Use canonicalPath() wherever dealing with file- & dir-paths.

This commit is contained in:
Christian Muehlhaeuser
2011-04-15 07:50:38 +02:00
parent 9af6ff7911
commit 66e3d07aee
2 changed files with 10 additions and 10 deletions

View File

@@ -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;
} }

View File

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