mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #7288 (calibre cannot work correctly if the temporary path contain non-ASCII characters)
This commit is contained in:
parent
1043079737
commit
0e23cdd9b6
@ -25,6 +25,7 @@ from calibre.translations.dynamic import translate
|
||||
from calibre.ebooks.chardet import xml_to_unicode
|
||||
from calibre.ebooks.oeb.entitydefs import ENTITYDEFS
|
||||
from calibre.ebooks.conversion.preprocess import CSSPreProcessor
|
||||
from calibre import isbytestring
|
||||
|
||||
RECOVER_PARSER = etree.XMLParser(recover=True, no_network=True)
|
||||
|
||||
@ -404,7 +405,8 @@ class DirContainer(object):
|
||||
|
||||
def __init__(self, path, log):
|
||||
self.log = log
|
||||
path = unicode(path)
|
||||
if isbytestring(path):
|
||||
path = path.decode(filesystem_encoding)
|
||||
ext = os.path.splitext(path)[1].lower()
|
||||
if ext == '.opf':
|
||||
self.opfname = os.path.basename(path)
|
||||
|
@ -7,8 +7,7 @@ being closed.
|
||||
"""
|
||||
import tempfile, os, atexit, binascii, cPickle
|
||||
|
||||
from calibre import __version__, __appname__, isbytestring
|
||||
from calibre.constants import filesystem_encoding
|
||||
from calibre.constants import __version__, __appname__
|
||||
|
||||
def cleanup(path):
|
||||
try:
|
||||
@ -43,8 +42,6 @@ def base_dir():
|
||||
_base_dir = tempfile.mkdtemp(prefix='%s_%s_tmp_'%(__appname__,
|
||||
__version__))
|
||||
atexit.register(remove_dir, _base_dir)
|
||||
if isbytestring(_base_dir):
|
||||
_base_dir = _base_dir.decode(filesystem_encoding)
|
||||
return _base_dir
|
||||
|
||||
class PersistentTemporaryFile(object):
|
||||
|
Loading…
x
Reference in New Issue
Block a user