src/eric7/SystemUtilities/FileSystemUtilities.py

branch
eric7
changeset 10338
7329b8d78f7b
parent 10170
6cf1ee737d8f
child 10339
446d22fa1aea
--- a/src/eric7/SystemUtilities/FileSystemUtilities.py	Fri Nov 24 09:29:46 2023 +0100
+++ b/src/eric7/SystemUtilities/FileSystemUtilities.py	Fri Nov 24 12:06:59 2023 +0100
@@ -589,7 +589,7 @@
         finally:
             ctypes.windll.kernel32.SetErrorMode(oldMode)
     else:
-        # we are on a Linux or macOS platform
+        # we are on a Linux, FreeBSD or macOS platform
         for mountCommand in ["mount", "/sbin/mount", "/usr/sbin/mount"]:
             with contextlib.suppress(FileNotFoundError):
                 mountOutput = subprocess.run(  # secok
@@ -637,12 +637,19 @@
             if os.path.exists(dirpath):
                 mountedPaths.append(dirpath)
     else:
-        # we are on a Linux or macOS platform
-        mountPathStart = (
-            "/media/{0}/".format(OSUtilities.getUserName())
-            if OSUtilities.isLinuxPlatform()
-            else "/Volumes/"
-        )
+        # we are on a Linux, FreeBSD or macOS platform
+        if OSUtilities.isMacPlatform():
+            # macOS
+            mountPathStart = "/Volumes/"
+        elif OSUtilities.isLinuxPlatform():
+            # Linux
+            mountPathStart = "/media/{0}/".format(OSUtilities.getUserName())
+        elif OSUtilities.isBsdPlatform():
+            # FreeBSD
+            mountPathStart = "/media/"
+        else:
+            # unsupported platform
+            return []
 
         for mountCommand in ["mount", "/sbin/mount", "/usr/sbin/mount"]:
             with contextlib.suppress(FileNotFoundError):

eric ide

mercurial