mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-07 09:01:38 -04:00
Make partition detection code on windows a little more robust
This commit is contained in:
parent
d1053b7bb5
commit
fc4c746554
@ -146,11 +146,12 @@ class PRS505(Device):
|
|||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
partition = drive.associators("Win32_DiskDriveToDiskPartition")[0]
|
partition = drive.associators("Win32_DiskDriveToDiskPartition")[0]
|
||||||
|
logical_disk = partition.associators('Win32_LogicalDiskToPartition')[0]
|
||||||
|
prefix = logical_disk.DeviceID+os.sep
|
||||||
|
drives.append((drive.Index, prefix))
|
||||||
except IndexError:
|
except IndexError:
|
||||||
continue
|
continue
|
||||||
logical_disk = partition.associators('Win32_LogicalDiskToPartition')[0]
|
|
||||||
prefix = logical_disk.DeviceID+os.sep
|
|
||||||
drives.append((drive.Index, prefix))
|
|
||||||
|
|
||||||
if not drives:
|
if not drives:
|
||||||
raise DeviceError('Unable to find %s. Is it connected?'%(self.__class__.__name__,))
|
raise DeviceError('Unable to find %s. Is it connected?'%(self.__class__.__name__,))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user