mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-27 21:59:17 +01:00
[update] Fix youtube-dl.exe updating from arbitrary directory (Closes #2718)
This commit is contained in:
parent
e5871c672b
commit
e9297256d4
1 changed files with 3 additions and 6 deletions
|
@ -83,11 +83,8 @@ def update_self(to_screen, verbose, opener):
|
|||
|
||||
print_notes(to_screen, versions_info['versions'])
|
||||
|
||||
filename = sys.argv[0]
|
||||
# Py2EXE: Filename could be different
|
||||
if hasattr(sys, 'frozen') and not os.path.isfile(filename):
|
||||
if os.path.isfile(filename + '.exe'):
|
||||
filename += '.exe'
|
||||
# sys.executable is set to the full pathname of the exe-file for py2exe
|
||||
filename = sys.executable if hasattr(sys, 'frozen') else sys.argv[0]
|
||||
|
||||
if not os.access(filename, os.W_OK):
|
||||
to_screen('ERROR: no write permissions on %s' % filename)
|
||||
|
@ -95,7 +92,7 @@ def update_self(to_screen, verbose, opener):
|
|||
|
||||
# Py2EXE
|
||||
if hasattr(sys, 'frozen'):
|
||||
exe = os.path.abspath(filename)
|
||||
exe = filename
|
||||
directory = os.path.dirname(exe)
|
||||
if not os.access(directory, os.W_OK):
|
||||
to_screen('ERROR: no write permissions on %s' % directory)
|
||||
|
|
Loading…
Reference in a new issue