mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:...
This commit is contained in:
parent
516e1ca962
commit
d54b49ce78
@ -8,7 +8,7 @@ from math import ceil
|
||||
|
||||
from calibre.ebooks.unidecode.unidecoder import Unidecoder
|
||||
from calibre import sanitize_file_name
|
||||
from calibre.constants import preferred_encoding
|
||||
from calibre.constants import preferred_encoding, iswindows
|
||||
udc = Unidecoder()
|
||||
|
||||
def ascii_text(orig):
|
||||
@ -65,3 +65,14 @@ def shorten_components_to(length, components):
|
||||
ans.append(r)
|
||||
return ans
|
||||
|
||||
def find_executable_in_path(name, path=None):
|
||||
if path is None:
|
||||
path = os.environ.get('PATH', '')
|
||||
sep = ';' if iswindows else ':'
|
||||
if iswindows and not name.endswith('.exe'):
|
||||
name += '.exe'
|
||||
path = path.split(sep)
|
||||
for x in path:
|
||||
q = os.path.abspath(os.path.join(x, name))
|
||||
if os.access(q, os.X_OK):
|
||||
return q
|
||||
|
17
src/calibre/utils/sigil.py
Normal file
17
src/calibre/utils/sigil.py
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import with_statement
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from calibre.utils.filenames import find_executable_in_path
|
||||
from calibre.constants import iswindows
|
||||
|
||||
def find_executable():
|
||||
name = 'sigil' + ('.exe' if iswindows else '')
|
||||
path = find_executable_in_path(name)
|
||||
#if path is None and iswindows:
|
||||
# path = search_program_files()
|
||||
|
Loading…
x
Reference in New Issue
Block a user