mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use unicode for all temp file paths. Fixes #7288 (calibre cannot work correctly if the temporary path contain non-ASCII characters)
This commit is contained in:
parent
3817baa67c
commit
1043079737
@ -7,7 +7,8 @@ being closed.
|
|||||||
"""
|
"""
|
||||||
import tempfile, os, atexit, binascii, cPickle
|
import tempfile, os, atexit, binascii, cPickle
|
||||||
|
|
||||||
from calibre import __version__, __appname__
|
from calibre import __version__, __appname__, isbytestring
|
||||||
|
from calibre.constants import filesystem_encoding
|
||||||
|
|
||||||
def cleanup(path):
|
def cleanup(path):
|
||||||
try:
|
try:
|
||||||
@ -42,6 +43,8 @@ def base_dir():
|
|||||||
_base_dir = tempfile.mkdtemp(prefix='%s_%s_tmp_'%(__appname__,
|
_base_dir = tempfile.mkdtemp(prefix='%s_%s_tmp_'%(__appname__,
|
||||||
__version__))
|
__version__))
|
||||||
atexit.register(remove_dir, _base_dir)
|
atexit.register(remove_dir, _base_dir)
|
||||||
|
if isbytestring(_base_dir):
|
||||||
|
_base_dir = _base_dir.decode(filesystem_encoding)
|
||||||
return _base_dir
|
return _base_dir
|
||||||
|
|
||||||
class PersistentTemporaryFile(object):
|
class PersistentTemporaryFile(object):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user