Bug 148419 - 'Remove Torrent & Data' does not delete empty directories
Summary: 'Remove Torrent & Data' does not delete empty directories
Status: RESOLVED FIXED
Alias: None
Product: ktorrent
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-01 12:14 UTC by Charles Phoenix
Modified: 2007-08-06 18:07 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Charles Phoenix 2007-08-01 12:14:33 UTC
Version:           2.2 (using KDE 3.5.7, Gentoo)
Compiler:          Target: x86_64-pc-linux-gnu
OS:                Linux (x86_64) release 2.6.20-gentoo-r8

Dir A - unchecked
Dir B - checked

Dir B will download like normal it will also be deleted when I select 'Remove Torrent & Data'

Dir A gets created but remains empty.

The undesirable behavior is that Dir A, and all parent directories remain after selecting 'Remove Torrent & Data'. They have to be deleted manually.

This is an explicit command therefore I would expect it to delete everything related to that torrent.
Comment 1 Joris Guisson 2007-08-06 18:07:36 UTC
SVN commit 697027 by guisson:

Make sure empty directories get deleted if the files in them are not selected for download

BUG: 148419


 M  +5 -5      multifilecache.cpp  


--- branches/extragear/kde3/network/ktorrent/libktorrent/torrent/multifilecache.cpp #697026:697027
@@ -734,12 +734,12 @@
 		for (Uint32 i = 0;i < tor.getNumFiles();i++)
 		{
 			TorrentFile & tf = tor.getFile(i);
-			if (tf.doNotDownload())
-				continue;
-			
 			QString fpath = tf.getPath();
-			// first delete the file
-			bt::Delete(output_dir + fpath);
+			if (!tf.doNotDownload())
+			{
+				// first delete the file
+				bt::Delete(output_dir + fpath);
+			}
 			
 			// check for subdirectories
 			DeleteEmptyDirs(output_dir,fpath);