Allow symlinked binaries inside the home dir

In case a user has system binaries symlinked to a directory in the home
directory, this is no longer ruled out in `exe_exists` to be used by
default.
This commit is contained in:
Claudio Bley 2021-06-10 16:08:37 +02:00
parent 4e3ec8ef24
commit 65dacdb7c8

View file

@ -30,9 +30,10 @@ def exe_exists(exe: str) -> bool:
if found is None: # exe exists if found is None: # exe exists
return False return False
realpath = os.path.realpath(found)
homedir = os.path.expanduser('~') homedir = os.path.expanduser('~')
try: try:
common: Optional[str] = os.path.commonpath((found, homedir)) common: Optional[str] = os.path.commonpath((realpath, homedir))
except ValueError: # on windows, different drives raises ValueError except ValueError: # on windows, different drives raises ValueError
common = None common = None