--- a/eric6/Utilities/__init__.py Thu Feb 04 14:35:50 2021 +0100 +++ b/eric6/Utilities/__init__.py Thu Feb 04 14:38:01 2021 +0100 @@ -1238,21 +1238,19 @@ return dirs -def findVolume(volumeName, all=False): +def findVolume(volumeName, findAll=False): """ Function to find the directory belonging to a given volume name. @param volumeName name of the volume to search for @type str - @param all flag indicating to get the directories for all volumes + @param findAll flag indicating to get the directories for all volumes starting with the given name (defaults to False) @type bool (optional) @return directory path or list of directory paths for the given volume name @rtype str or list of str """ - # TODO: add option to get all (i.e. all starting with volumeName) - # and return a list of found directories volumeDirectories = [] volumeDirectory = None @@ -1285,7 +1283,7 @@ for disk in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": dirpath = "{0}:\\".format(disk) if os.path.exists(dirpath): - if all: + if findAll: if getVolumeName(dirpath).startswith(volumeName): volumeDirectories.append(dirpath) else: @@ -1302,7 +1300,7 @@ subprocess.check_output(mountCommand).splitlines() # secok ) mountedVolumes = [x.split()[2] for x in mountOutput] - if all: + if findAll: for volume in mountedVolumes: if volumeName in volume.decode("utf-8"): volumeDirectories.append(volume.decode("utf-8")) @@ -1318,7 +1316,7 @@ except FileNotFoundError: pass - if all: + if findAll: return volumeDirectories else: return volumeDirectory