Utilties: changed the volume detection logic to be able to deal with volume names containing spaces.

Sat, 13 Feb 2021 12:48:40 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 13 Feb 2021 12:48:40 +0100
changeset 8100
a4c231453cbc
parent 8099
522946e53835
child 8101
dee984e05647

Utilties: changed the volume detection logic to be able to deal with volume names containing spaces.

eric6/Utilities/__init__.py file | annotate | diff | comparison | revisions
--- a/eric6/Utilities/__init__.py	Fri Feb 12 19:23:28 2021 +0100
+++ b/eric6/Utilities/__init__.py	Sat Feb 13 12:48:40 2021 +0100
@@ -1300,17 +1300,20 @@
                 mountOutput = (
                     subprocess.check_output(mountCommand).splitlines()  # secok
                 )
-                mountedVolumes = [x.split()[2] for x in mountOutput]
+                mountedVolumes = [
+                    x.decode("utf-8").split(" type")[0].split(maxsplit=2)[2]
+                    for x in mountOutput
+                ]
                 if findAll:
                     for volume in mountedVolumes:
-                        if volumeName in volume.decode("utf-8"):
-                            volumeDirectories.append(volume.decode("utf-8"))
+                        if volumeName in volume:
+                            volumeDirectories.append(volume)
                     if volumeDirectories:
                         break
                 else:
                     for volume in mountedVolumes:
-                        if volume.decode("utf-8").endswith(volumeName):
-                            volumeDirectory = volume.decode("utf-8")
+                        if volume.endswith(volumeName):
+                            volumeDirectory = volume
                             break
                     if volumeDirectory:
                         break

eric ide

mercurial