mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-03-06 10:56:03 +01:00
Make partition detection code on windows a little more robust
This commit is contained in:
parent
45d114bc32
commit
2a583c3a75
1 changed files with 6 additions and 3 deletions
|
|
@ -100,6 +100,8 @@ def get_fdi(cls):
|
|||
@classmethod
|
||||
def is_device(cls, device_id):
|
||||
'''print "mimi in is device"'''
|
||||
if not hasattr(device_id, 'upper'):
|
||||
return False
|
||||
|
||||
if 'VEN_'+cls.VENDOR_NAME in device_id.upper() and \
|
||||
'PROD_'+cls.INTERNAL_STORAGE in device_id.upper():
|
||||
|
|
@ -153,11 +155,12 @@ def open_windows(self):
|
|||
continue
|
||||
try:
|
||||
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:
|
||||
continue
|
||||
logical_disk = partition.associators('Win32_LogicalDiskToPartition')[0]
|
||||
prefix = logical_disk.DeviceID+os.sep
|
||||
drives.append((drive.Index, prefix))
|
||||
|
||||
|
||||
if not drives:
|
||||
print self.__class__.__name__
|
||||
|
|
|
|||
Loading…
Reference in a new issue