587 volumeDirectory = dirpath |
587 volumeDirectory = dirpath |
588 break |
588 break |
589 finally: |
589 finally: |
590 ctypes.windll.kernel32.SetErrorMode(oldMode) |
590 ctypes.windll.kernel32.SetErrorMode(oldMode) |
591 else: |
591 else: |
592 # we are on a Linux or macOS platform |
592 # we are on a Linux, FreeBSD or macOS platform |
593 for mountCommand in ["mount", "/sbin/mount", "/usr/sbin/mount"]: |
593 for mountCommand in ["mount", "/sbin/mount", "/usr/sbin/mount"]: |
594 with contextlib.suppress(FileNotFoundError): |
594 with contextlib.suppress(FileNotFoundError): |
595 mountOutput = subprocess.run( # secok |
595 mountOutput = subprocess.run( # secok |
596 mountCommand, check=True, capture_output=True, text=True |
596 mountCommand, check=True, capture_output=True, text=True |
597 ).stdout.splitlines() |
597 ).stdout.splitlines() |
635 for disk in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": |
635 for disk in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": |
636 dirpath = "{0}:\\".format(disk) |
636 dirpath = "{0}:\\".format(disk) |
637 if os.path.exists(dirpath): |
637 if os.path.exists(dirpath): |
638 mountedPaths.append(dirpath) |
638 mountedPaths.append(dirpath) |
639 else: |
639 else: |
640 # we are on a Linux or macOS platform |
640 # we are on a Linux, FreeBSD or macOS platform |
641 mountPathStart = ( |
641 if OSUtilities.isMacPlatform(): |
642 "/media/{0}/".format(OSUtilities.getUserName()) |
642 # macOS |
643 if OSUtilities.isLinuxPlatform() |
643 mountPathStart = "/Volumes/" |
644 else "/Volumes/" |
644 elif OSUtilities.isLinuxPlatform(): |
645 ) |
645 # Linux |
|
646 mountPathStart = "/media/{0}/".format(OSUtilities.getUserName()) |
|
647 elif OSUtilities.isBsdPlatform(): |
|
648 # FreeBSD |
|
649 mountPathStart = "/media/" |
|
650 else: |
|
651 # unsupported platform |
|
652 return [] |
646 |
653 |
647 for mountCommand in ["mount", "/sbin/mount", "/usr/sbin/mount"]: |
654 for mountCommand in ["mount", "/sbin/mount", "/usr/sbin/mount"]: |
648 with contextlib.suppress(FileNotFoundError): |
655 with contextlib.suppress(FileNotFoundError): |
649 mountOutput = subprocess.run( # secok |
656 mountOutput = subprocess.run( # secok |
650 mountCommand, check=True, capture_output=True, text=True |
657 mountCommand, check=True, capture_output=True, text=True |