diff --git a/thefuck/utils.py b/thefuck/utils.py index f79e814e..4ccef48e 100644 --- a/thefuck/utils.py +++ b/thefuck/utils.py @@ -109,22 +109,19 @@ def get_all_executables(): tf_alias = get_alias() tf_entry_points = ['thefuck', 'fuck'] - - win32 = sys.platform.startswith('win') - paths = os.environ.get('PATH', '') - paths = paths.split(';') if win32 else paths.split(':') - + bins = [exe.name.decode('utf8') if six.PY2 else exe.name - for path in paths + for path in os.environ.get('PATH', '').split(os.pathsep) for exe in _safe(lambda: list(Path(path).iterdir()), []) if not _safe(exe.is_dir, True) and exe.name not in tf_entry_points] aliases = [alias.decode('utf8') if six.PY2 else alias for alias in shell.get_aliases() if alias != tf_alias] - + + win32 = sys.platform.startswith('win') if win32: bins += [exe[:-4] for exe in bins if exe.endswith(".exe")] - + return bins + aliases