diff options
-rw-r--r-- | Cura/util/removableStorage.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Cura/util/removableStorage.py b/Cura/util/removableStorage.py index daf5dbb5e7..1eb807d9a0 100644 --- a/Cura/util/removableStorage.py +++ b/Cura/util/removableStorage.py @@ -88,6 +88,21 @@ def getPossibleSDcardDrives(): if 'mount_point' in vol: volume = vol['mount_point'] drives.append((os.path.basename(volume), volume, os.path.basename(volume))) + + p = subprocess.Popen(['system_profiler', 'SPCardReaderDataType', '-xml'], stdout=subprocess.PIPE) + xml = ElementTree.fromstring(p.communicate()[0]) + p.wait() + + xml = _parseStupidPListXML(xml) + for entry in xml: + if '_items' in entry: + for item in entry['_items']: + for dev in item['_items']: + if 'removable_media' in dev and dev['removable_media'] == 'yes' and 'volumes' in dev and len(dev['volumes']) > 0: + for vol in dev['volumes']: + if 'mount_point' in vol: + volume = vol['mount_point'] + drives.append((os.path.basename(volume), volume, os.path.basename(volume))) else: for volume in glob.glob('/media/*'): drives.append((os.path.basename(volume), volume, os.path.basename(volume))) |