Bug 136757

Summary: "Move files to collection..." deletes directory if no files left
Product: [Applications] amarok Reporter: Adam Porter <adam>
Component: Collections/LocalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Adam Porter 2006-11-03 08:37:30 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Debian testing/unstable Packages

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=368174

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 
exists.
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 );
             config.sync();
-            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;
    }