Author: andar
Revision: 5443
Log:
Fix renaming files with / in them
Diff:
Modified: trunk/deluge/ui/gtkui/addtorrentdialog.py
===================================================================
--- trunk/deluge/ui/gtkui/addtorrentdialog.py 2009-07-02 18:51:26 UTC (rev
5442)
+++ trunk/deluge/ui/gtkui/addtorrentdialog.py 2009-07-04 16:49:18 UTC (rev
5443)
@@ -813,13 +813,25 @@
if index > -1:
# We're renaming a file! Yay! That's easy!
- file_path =
self.get_file_path(self.files_treestore.iter_parent(itr))
-
+ parent = self.files_treestore.iter_parent(itr)
+ file_path = self.get_file_path(parent)
file_path += new_text
+ file_path = file_path.replace("//", "/")
- # Update the row's text
- self.files_treestore[itr][1] = new_text
+ if "/" in new_text:
+ # There are folders in this path, so we need to create them
+ # and then move the file iter to top
+ split_text = new_text.split("/")
+ for s in split_text[:-1]:
+ parent = self.files_treestore.append(parent,
+ [True, s, 0, -1, False, gtk.STOCK_DIRECTORY])
+ self.files_treestore[itr][1] = split_text[-1]
+ common.reparent_iter(self.files_treestore, itr, parent)
+ else:
+ # Update the row's text
+ self.files_treestore[itr][1] = new_text
+
# Update the mapped_files dict in the options with the index and
new
# file path.
# We'll send this to the core when adding the torrent so it knows
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---