1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-17 19:37:09 +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

@@ -1,5 +1,5 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* 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 = ?" )
.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();
while ( dirquery.next() )
{
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() )
qDebug() << "Skipping subdir:" << fi.absolutePath();
if ( lastPath != fi.canonicalPath() )
qDebug() << "Skipping subdir:" << fi.canonicalPath();
lastPath = fi.absolutePath();
lastPath = fi.canonicalPath();
continue;
}
@@ -133,11 +133,11 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
<< delquery.boundValues();
continue;
}
deleted++;
}
}
qDebug() << "Deleted" << deleted << m_ids << m_files;
emit done( m_files, source()->collection() );

View File

@@ -1,5 +1,5 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* 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 "
"WHERE name LIKE :prefix" ) );
query.bindValue( ":prefix", path.absolutePath() + "%" );
query.bindValue( ":prefix", path.canonicalPath() + "%" );
query.exec();
while( query.next() )