mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make partition detection code on windows a little more robust
This commit is contained in:
parent
45d114bc32
commit
2a583c3a75
@ -100,6 +100,8 @@ class KINDLE(Device):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def is_device(cls, device_id):
|
def is_device(cls, device_id):
|
||||||
'''print "mimi in is device"'''
|
'''print "mimi in is device"'''
|
||||||
|
if not hasattr(device_id, 'upper'):
|
||||||
|
return False
|
||||||
|
|
||||||
if 'VEN_'+cls.VENDOR_NAME in device_id.upper() and \
|
if 'VEN_'+cls.VENDOR_NAME in device_id.upper() and \
|
||||||
'PROD_'+cls.INTERNAL_STORAGE in device_id.upper():
|
'PROD_'+cls.INTERNAL_STORAGE in device_id.upper():
|
||||||
@ -153,11 +155,12 @@ class KINDLE(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:
|
||||||
print self.__class__.__name__
|
print self.__class__.__name__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user