Merge pull request #4779 from PySimpleGUI/Dev-latest
Simplified support to be for local files only
This commit is contained in:
commit
6d61943a82
|
@ -31,24 +31,18 @@ def create_shortcut(path, target='', icon=''):
|
||||||
"""
|
"""
|
||||||
filename, ext = os.path.splitext(path)
|
filename, ext = os.path.splitext(path)
|
||||||
working_dir = os.path.dirname(filename)
|
working_dir = os.path.dirname(filename)
|
||||||
if ext == 'url':
|
shell = Dispatch('WScript.Shell')
|
||||||
shortcut = file(filename, 'w')
|
shortcut_filename = filename + ".lnk"
|
||||||
shortcut.write('[InternetShortcut]\n')
|
shortcut = shell.CreateShortCut(f'{shortcut_filename}')
|
||||||
shortcut.write('URL=%s' % target)
|
target_path = f'{target}'
|
||||||
shortcut.close()
|
shortcut.Targetpath = target_path
|
||||||
|
shortcut.Arguments = f'"{path}"'
|
||||||
|
shortcut.WorkingDirectory = working_dir
|
||||||
|
if icon == '':
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
shell = Dispatch('WScript.Shell')
|
shortcut.IconLocation = icon
|
||||||
shortcut_filename = filename + ".lnk"
|
shortcut.save()
|
||||||
shortcut = shell.CreateShortCut(f'{shortcut_filename}')
|
|
||||||
target_path = f'{target}'
|
|
||||||
shortcut.Targetpath = target_path
|
|
||||||
shortcut.Arguments = f'"{path}"'
|
|
||||||
shortcut.WorkingDirectory = working_dir
|
|
||||||
if icon == '':
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
shortcut.IconLocation = icon
|
|
||||||
shortcut.save()
|
|
||||||
return shortcut_filename
|
return shortcut_filename
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue