mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
OS X: Fix restarting of calibre not working if calibre.app is placed in a location with spaces in the path
This commit is contained in:
parent
f6e42f4cc1
commit
84b92f5d31
@ -322,6 +322,9 @@ def run_in_debug_mode(logpath=None):
|
|||||||
stderr=subprocess.STDOUT, stdin=open(os.devnull, 'r'),
|
stderr=subprocess.STDOUT, stdin=open(os.devnull, 'r'),
|
||||||
creationflags=creationflags)
|
creationflags=creationflags)
|
||||||
|
|
||||||
|
def shellquote(s):
|
||||||
|
return "'" + s.replace("'", "'\\''") + "'"
|
||||||
|
|
||||||
def run_gui(opts, args, listener, app, gui_debug=None):
|
def run_gui(opts, args, listener, app, gui_debug=None):
|
||||||
initialize_file_icon_provider()
|
initialize_file_icon_provider()
|
||||||
app.load_builtin_fonts(scan_for_fonts=True)
|
app.load_builtin_fonts(scan_for_fonts=True)
|
||||||
@ -344,8 +347,8 @@ def run_gui(opts, args, listener, app, gui_debug=None):
|
|||||||
import subprocess
|
import subprocess
|
||||||
print 'Restarting with:', e, sys.argv
|
print 'Restarting with:', e, sys.argv
|
||||||
if hasattr(sys, 'frameworks_dir'):
|
if hasattr(sys, 'frameworks_dir'):
|
||||||
app = os.path.dirname(os.path.dirname(sys.frameworks_dir))
|
app = os.path.dirname(os.path.dirname(os.path.realpath(sys.frameworks_dir)))
|
||||||
subprocess.Popen('sleep 3s; open '+app, shell=True)
|
subprocess.Popen('sleep 3s; open ' + shellquote(app), shell=True)
|
||||||
else:
|
else:
|
||||||
if iswindows and hasattr(winutil, 'prepare_for_restart'):
|
if iswindows and hasattr(winutil, 'prepare_for_restart'):
|
||||||
winutil.prepare_for_restart()
|
winutil.prepare_for_restart()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user