pull/62/head
Thomas Bouve 2021-09-05 23:05:37 +02:00
rodzic d2fbe5afe8
commit 3f5c14c92c
1 zmienionych plików z 4 dodań i 5 usunięć

Wyświetl plik

@ -99,17 +99,16 @@ def prepend_dir_icons(dir_list: Iterable[str]) -> List[str]:
def get_drive_letters(path: str) -> List[str]:
"""Get drive letters."""
if sys.platform == 'win32':
# Check if driveletter is upper or lowercase
# Check if path uses upper or lowercase drive letters
chars = string.ascii_lowercase
if path[0].isupper():
chars = string.ascii_uppercase
# Windows has drive letters
return [
f'{d}:\\' for d in chars
if os.path.exists(f'{d}:')
].remove(path)
drives = [f'{d}:\\' for d in chars if os.path.exists(f'{d}:')]
drives.remove(path)
return drives
else:
# Unix does not have drive letters
return []