mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix restore library failing on some windows systems with non-ascii library paths
This commit is contained in:
parent
15aadb14c4
commit
0c8a8ea825
@ -15,7 +15,7 @@ from calibre.db.backend import DB, DBPrefs
|
|||||||
from calibre.db.cache import Cache
|
from calibre.db.cache import Cache
|
||||||
from calibre.constants import filesystem_encoding
|
from calibre.constants import filesystem_encoding
|
||||||
from calibre.utils.date import utcfromtimestamp
|
from calibre.utils.date import utcfromtimestamp
|
||||||
from calibre import isbytestring
|
from calibre import isbytestring, force_unicode
|
||||||
|
|
||||||
NON_EBOOK_EXTENSIONS = frozenset([
|
NON_EBOOK_EXTENSIONS = frozenset([
|
||||||
'jpg', 'jpeg', 'gif', 'png', 'bmp',
|
'jpg', 'jpeg', 'gif', 'png', 'bmp',
|
||||||
@ -71,8 +71,8 @@ class Restore(Thread):
|
|||||||
if failures:
|
if failures:
|
||||||
ans += 'Failed to restore the books in the following folders:\n'
|
ans += 'Failed to restore the books in the following folders:\n'
|
||||||
for dirpath, tb in failures:
|
for dirpath, tb in failures:
|
||||||
ans += '\t' + dirpath + ' with error:\n'
|
ans += '\t' + force_unicode(dirpath, filesystem_encoding) + ' with error:\n'
|
||||||
ans += '\n'.join('\t\t'+x for x in tb.splitlines())
|
ans += '\n'.join('\t\t'+force_unicode(x, filesystem_encoding) for x in tb.splitlines())
|
||||||
ans += '\n\n'
|
ans += '\n\n'
|
||||||
|
|
||||||
if self.conflicting_custom_cols:
|
if self.conflicting_custom_cols:
|
||||||
@ -93,7 +93,7 @@ class Restore(Thread):
|
|||||||
ans += '\n\n'
|
ans += '\n\n'
|
||||||
ans += 'The following folders were ignored:\n'
|
ans += 'The following folders were ignored:\n'
|
||||||
for x in self.mismatched_dirs:
|
for x in self.mismatched_dirs:
|
||||||
ans += '\t'+x+'\n'
|
ans += '\t' + force_unicode(x, filesystem_encoding) + '\n'
|
||||||
|
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user