Bug 136757 - "Move files to collection..." deletes directory if no files left
Summary: "Move files to collection..." deletes directory if no files left
Alias: None
Product: amarok
Classification: Applications
Component: Collections/Local (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Amarok Developers
Depends on:
Reported: 2006-11-03 08:37 UTC by Adam Porter
Modified: 2007-05-21 13:50 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Adam Porter 2006-11-03 08:37:30 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Debian testing/unstable Packages


If you have a single MP3 in a directory, and use the "Files" pane to view that file in the directory, and then right-click the file and "Move file to collection...", Amarok 
will then delete the directory.  This is quite annoying when I have a script running that dumps files into that directory, which then fails because the directory no longer 
Comment 1 Mark Kretschmann 2006-11-03 09:17:12 UTC
I agree, this sounds like a bug.
Comment 2 Seb Ruiz 2006-11-03 12:37:45 UTC
Well this is a silent feature which i snuck in because i found it useful. After using the organise music feature, empty directories would be left within the collection folder, and its really bloody annoying to remove them.
Comment 3 Martin Aumueller 2006-11-04 12:24:50 UTC
A work-around is to put a file that won't be organized into this directory - 
e.g. do 'touch .keep'.

I agree with Mark that this feature can be seen as a bug, but I also think 
that it comes in quite handy at times. Perhaps it should be disabled, if 
files being organized are not yet part of the collection dirctory hierarchy?
Comment 4 Seb Ruiz 2007-05-21 13:50:32 UTC
SVN commit 666959 by seb:

When organising files, only delete the parent directory if it is within the Collection heirarchy.
BUG: 136757

 M  +1 -4      collectiondb.cpp  

--- branches/stable/extragear/multimedia/amarok/src/collectiondb.cpp #666958:666959
@@ -4056,17 +4056,14 @@
          if( !config.hasKey("Icon") )
-            //config.writeEntry("Icon", QString("%1/.front.png").arg( path ));
             config.writeEntry( "Icon", cover );
-            debug() << "Using this cover as icon for: " << path << endl;
-            debug() << cover << endl;
          //}         //Not amazon nice.
-   if( localFile && QDir().rmdir( src.directory() ) )
+   if( localFile && isDirInCollection( src.directory() ) && QDir().rmdir( src.directory() ) )
       debug() << "removed: " << src.directory() << endl;