mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Shorten calibre GUI socket name
macOS and its archaic socket pathlen limits. Sigh.
This commit is contained in:
parent
55a8499995
commit
50d71bda18
@ -40,10 +40,12 @@ def socket_address(which):
|
|||||||
ans += '-' + user[:100] + 'x'
|
ans += '-' + user[:100] + 'x'
|
||||||
else:
|
else:
|
||||||
user = force_unicode(os.environ.get('USER') or os.path.basename(os.path.expanduser('~')), filesystem_encoding)
|
user = force_unicode(os.environ.get('USER') or os.path.basename(os.path.expanduser('~')), filesystem_encoding)
|
||||||
sock_name = '{}-calibre-{}.socket'.format(ascii_filename(user).replace(' ', '_'), which)
|
|
||||||
if islinux:
|
if islinux:
|
||||||
|
sock_name = '{}-calibre-{}.socket'.format(ascii_filename(user).replace(' ', '_'), which)
|
||||||
ans = '\0' + sock_name
|
ans = '\0' + sock_name
|
||||||
else:
|
else:
|
||||||
|
# tempdir already contains calibre in its path
|
||||||
|
sock_name = '{}-{}.sock'.format(ascii_filename(user).replace(' ', '_'), which)
|
||||||
from tempfile import gettempdir
|
from tempfile import gettempdir
|
||||||
tmp = force_unicode(gettempdir(), filesystem_encoding)
|
tmp = force_unicode(gettempdir(), filesystem_encoding)
|
||||||
ans = os.path.join(tmp, sock_name)
|
ans = os.path.join(tmp, sock_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user