fixed logic error that caused roots of NTFS drives to return as not NTFS

This commit is contained in:
Brennen Raimer
2019-05-25 11:29:06 -04:00
parent 76d1121206
commit fdf8e7d0a2

View File

@@ -18,9 +18,9 @@ class Location_Validator(QtGui.QValidator):
opening a warning window for each subdirectory in the location path was to track this and return the same opening a warning window for each subdirectory in the location path was to track this and return the same
value that was returned the last time it was validated.""" value that was returned the last time it was validated."""
@property @property
def ntfs_location_selected(self): def ntfs_location_selected(self):
return Location_Validator._ntfs_location_selected return Location_Validator._ntfs_location_selected
def _onNTFSDrive(self, location): def _onNTFSDrive(self, location):
"""Tests if location is a path on an NTFS-formatted drive. Returns True if path is on NTFS-formatted drive. """Tests if location is a path on an NTFS-formatted drive. Returns True if path is on NTFS-formatted drive.
@@ -28,7 +28,9 @@ class Location_Validator(QtGui.QValidator):
Arguments: Arguments:
location {str} -- A string representing a folder path location {str} -- A string representing a folder path
""" """
match = [drive for drive in psutil.disk_partitions(all = True) if (Path(drive.mountpoint) in Path(location).parents and drive.fstype.lower() == "ntfs")] match = [drive for drive in psutil.disk_partitions(all = True)
if (Path(drive.mountpoint) in Path(location).parents or Path(drive.mountpoint) == Path(location))
and drive.fstype.lower() == "ntfs"]
if match: if match:
self._ntfs_location_selected = True self._ntfs_location_selected = True
return True return True