[update] Fix youtube-dl.exe updating from arbitrary directory (Closes #2718)

pull/2/head
Sergey M․ 9 years ago
parent e5871c672b
commit e9297256d4
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

@ -83,11 +83,8 @@ def update_self(to_screen, verbose, opener):
print_notes(to_screen, versions_info['versions']) print_notes(to_screen, versions_info['versions'])
filename = sys.argv[0] # sys.executable is set to the full pathname of the exe-file for py2exe
# Py2EXE: Filename could be different filename = sys.executable if hasattr(sys, 'frozen') else sys.argv[0]
if hasattr(sys, 'frozen') and not os.path.isfile(filename):
if os.path.isfile(filename + '.exe'):
filename += '.exe'
if not os.access(filename, os.W_OK): if not os.access(filename, os.W_OK):
to_screen('ERROR: no write permissions on %s' % filename) to_screen('ERROR: no write permissions on %s' % filename)
@ -95,7 +92,7 @@ def update_self(to_screen, verbose, opener):
# Py2EXE # Py2EXE
if hasattr(sys, 'frozen'): if hasattr(sys, 'frozen'):
exe = os.path.abspath(filename) exe = filename
directory = os.path.dirname(exe) directory = os.path.dirname(exe)
if not os.access(directory, os.W_OK): if not os.access(directory, os.W_OK):
to_screen('ERROR: no write permissions on %s' % directory) to_screen('ERROR: no write permissions on %s' % directory)

Loading…
Cancel
Save