tags 415873 patch
thanks
Hello,
The problem is that the parent directory of a file cannot be renamed at
the same time this file is renamed. The directory must be renamed
separately.
The attached patch make sure that
* only the file names (not directory names) are renamed.
* directories are renamed separately
A third column had to be added to keep a correct string representation of
the renamed path (otherwise a path can be a mix of latin-1 and utf-8)
Kind Regards,
--
Nekral
diff -rauN ../orig/utf8-migration-tool-0.5.2/debian/changelog utf8-migration-tool-0.5.3/debian/changelog
--- ../orig/utf8-migration-tool-0.5.2/debian/changelog 2007-01-15 18:41:07.000000000 +0100
+++ utf8-migration-tool-0.5.3/debian/changelog 2007-03-23 00:39:18.000000000 +0100
@@ -1,3 +1,10 @@
+utf8-migration-tool (0.5.3) unstable; urgency=low
+
+ * Do not rename directories at the same time as files.
+ * Rename directories (separately), if needed.
+
+ -- Martin-Éric Racine <[EMAIL PROTECTED]> Fri, 23 Mar 2007 00:37:04 +0100
+
utf8-migration-tool (0.5.2) unstable; urgency=high
* Fixed typo that resulted in RC bug (Closes: #406966).
diff -rauN ../orig/utf8-migration-tool-0.5.2/pylib/wizard/steps.py utf8-migration-tool-0.5.3/pylib/wizard/steps.py
--- ../orig/utf8-migration-tool-0.5.2/pylib/wizard/steps.py 2006-06-11 14:33:35.000000000 +0200
+++ utf8-migration-tool-0.5.3/pylib/wizard/steps.py 2007-03-23 00:36:23.000000000 +0100
@@ -97,7 +97,7 @@
icon = 'wizard.png'
last_step = True
has_worker = False
- model = gtk.ListStore(str, str)
+ model = gtk.ListStore(str, str, str)
column = gtk.TreeViewColumn("File name")
currentEncoding = ""
@@ -105,7 +105,7 @@
super(FileNameConversion, self).__init__(params)
self.renderer = gtk.CellRendererText()
self.column.pack_start(self.renderer, True)
- self.column.set_attributes(self.renderer, text=1)
+ self.column.set_attributes(self.renderer, text=2)
self.renderer.set_property('editable', True)
def edited_cb(self, cell, path, new_text, user_data):
@@ -116,15 +116,19 @@
filenames = []
for root, dirs, files in os.walk(os.path.expanduser('~'), topdown=False):
- for f in files:
+ for f in files+dirs:
try:
unicode(f, "utf-8")
except UnicodeDecodeError:
try:
- filenames.append((root+"/"+f, unicode(root+"/"+f, self.currentEncoding)))
+ filenames.append((root+"/"+f,
+ root+"/"+unicode(f, self.currentEncoding).encode('utf-8'),
+ unicode(root+"/"+f, self.currentEncoding)))
except UnicodeDecodeError:
# Sane fallback
- filenames.append((root+"/"+f, unicode(root+"/"+f, "iso8859-1")))
+ filenames.append((root+"/"+f,
+ root+"/"+unicode(f, "iso8859-1").encode('utf-8'),
+ unicode(root+"/"+f, "iso8859-1")))
self.set_files(filenames)