mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix regression that broke recursive adding on windows with non ascii file paths
This commit is contained in:
parent
7178234279
commit
c8ca1afe70
@ -43,12 +43,8 @@ class RecursiveFind(QThread):
|
||||
self.single_book_per_directory = single
|
||||
self.canceled = False
|
||||
|
||||
def run(self):
|
||||
root = os.path.abspath(self.path)
|
||||
def walk(self, root):
|
||||
self.books = []
|
||||
if isinstance(root, unicode):
|
||||
root = root.encode(filesystem_encoding)
|
||||
try:
|
||||
for dirpath in os.walk(root):
|
||||
if self.canceled:
|
||||
return
|
||||
@ -56,6 +52,16 @@ class RecursiveFind(QThread):
|
||||
_('Searching in')+' '+dirpath[0])
|
||||
self.books += list(self.db.find_books_in_directory(dirpath[0],
|
||||
self.single_book_per_directory))
|
||||
|
||||
def run(self):
|
||||
root = os.path.abspath(self.path)
|
||||
try:
|
||||
self.walk(root)
|
||||
except:
|
||||
try:
|
||||
if isinstance(root, unicode):
|
||||
root = root.encode(filesystem_encoding)
|
||||
self.walk(root)
|
||||
except Exception, err:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
Loading…
x
Reference in New Issue
Block a user