mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Open With: Fix open with not working for programs from the Microsoft Office suite
This commit is contained in:
parent
01e9cd29ce
commit
c60d39c519
@ -202,7 +202,12 @@ def get_open_data(base, prog_id):
|
|||||||
if err.errno == winerror.ERROR_FILE_NOT_FOUND:
|
if err.errno == winerror.ERROR_FILE_NOT_FOUND:
|
||||||
return None, None, None
|
return None, None, None
|
||||||
with k:
|
with k:
|
||||||
return k.get(sub_key=r'shell\open\command'), k.get(sub_key='DefaultIcon'), k.get_mui_string('FriendlyTypeName') or k.get()
|
cmd = k.get(sub_key=r'shell\open\command')
|
||||||
|
if cmd:
|
||||||
|
parts = cmd.split()
|
||||||
|
if parts[-1] == '/dde' and '%1' not in cmd:
|
||||||
|
cmd = ' '.join(parts[:-1]) + ' "%1"'
|
||||||
|
return cmd, k.get(sub_key='DefaultIcon'), k.get_mui_string('FriendlyTypeName') or k.get()
|
||||||
|
|
||||||
CommandLineToArgvW = ctypes.windll.shell32.CommandLineToArgvW
|
CommandLineToArgvW = ctypes.windll.shell32.CommandLineToArgvW
|
||||||
CommandLineToArgvW.arg_types = [LPCWSTR, ctypes.POINTER(ctypes.c_int)]
|
CommandLineToArgvW.arg_types = [LPCWSTR, ctypes.POINTER(ctypes.c_int)]
|
||||||
@ -290,4 +295,4 @@ def find_programs(extensions):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
pprint(find_programs('jpeg pdf'.split()))
|
pprint(find_programs('docx'.split()))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user