scripts/create_windows_links.py

changeset 8243
cc717c2ae956
parent 7960
e8fc383322f7
child 8314
e3642a6a1e71
equal deleted inserted replaced
8242:aa713ac50c0d 8243:cc717c2ae956
9 Installation script for the eric IDE and all eric related tools. 9 Installation script for the eric IDE and all eric related tools.
10 """ 10 """
11 11
12 import os 12 import os
13 import sys 13 import sys
14 import contextlib
14 15
15 from eric6config import getConfig 16 from eric6config import getConfig
16 17
17 18
18 def main(argv): 19 def main(argv):
91 @type str 92 @type str
92 """ 93 """
93 from win32com.client import Dispatch 94 from win32com.client import Dispatch
94 from pywintypes import com_error 95 from pywintypes import com_error
95 96
96 try: 97 with contextlib.suppress(com_error):
97 shell = Dispatch('WScript.Shell') 98 shell = Dispatch('WScript.Shell')
98 shortcut = shell.CreateShortCut(linkPath) 99 shortcut = shell.CreateShortCut(linkPath)
99 shortcut.Targetpath = targetPath 100 shortcut.Targetpath = targetPath
100 shortcut.WorkingDirectory = os.path.dirname(targetPath) 101 shortcut.WorkingDirectory = os.path.dirname(targetPath)
101 shortcut.IconLocation = iconPath 102 shortcut.IconLocation = iconPath
102 shortcut.save() 103 shortcut.save()
103 except com_error:
104 # maybe restrictions prohibited link creation
105 pass
106 104
107 105
108 def windowsDesktopNames(): 106 def windowsDesktopNames():
109 """ 107 """
110 Function to generate the link names for the Windows Desktop. 108 Function to generate the link names for the Windows Desktop.

eric ide

mercurial