SqlCollectionLocation::startNextJob() not properly copying files patch
Casey Jones
jonescaseyb at gmail.com
Fri Oct 9 00:11:59 CEST 2009
On Wednesday 07 October 2009 2:26:24 am Mark Kretschmann wrote:
>
> Yes, I will try to evaluate this patch today.
>
What I did to test was to create a backup of my collection (obvious), and then
I used the OrganizeCollectionDialog to organize my collection by Album.
Without this patch, in the debug output you'll see that you get errors for
most files it tries to copy. This happens because the first file it copies ends
up being root/AlbumName. And each file after that in that folder tries to copy
to root/AlbumName, but that file already exists.
KUrl src is the url to the original file, but KUrl dest is only the url to the
directory to put the file in.
So when copying the files with KIO::file_copy(src, dest) it translates to this
unix stlye cp command.
cp root/oldDir/song.mp3 root/AlbumName
Which doesn't mean "put the file _in_ AlbumName", it means "put the file _in_
root, and _name_ it AlbumName." So by creating finalDest and appending the
file's name to the end you get this working cp command.
cp root/oldDir/song.mp3 root/AlbumName/song.mp3
QFileInfo info.dir() only returned the collection root, I'm assuming that's
because it thinks AlbumName is a file, not a directory. So by using
info.absoluteFilePath() it returned root/AlbumName, which was then checked for
existance, and then it makes that directory.
Casey
More information about the Amarok-devel
mailing list