mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Removable drives with any name are now accepted by OSX
I have no idea why the old plugin only accepted drives with the name "MASS STORAGE DEVICE", but it now simply lists all removable drives CURA-1365
This commit is contained in:
parent
b62c890bfa
commit
24950627dc
@ -20,7 +20,10 @@ class OSXRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
|
|||||||
plist = plistlib.loads(p.communicate()[0])
|
plist = plistlib.loads(p.communicate()[0])
|
||||||
p.wait()
|
p.wait()
|
||||||
|
|
||||||
for dev in self._findInTree(plist, "Mass Storage Device"):
|
for entry in plist:
|
||||||
|
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:
|
if "removable_media" in dev and dev["removable_media"] == "yes" and "volumes" in dev and len(dev["volumes"]) > 0:
|
||||||
for vol in dev["volumes"]:
|
for vol in dev["volumes"]:
|
||||||
if "mount_point" in vol:
|
if "mount_point" in vol:
|
||||||
@ -52,15 +55,3 @@ class OSXRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
|
|||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _findInTree(self, t, n):
|
|
||||||
ret = []
|
|
||||||
if type(t) is dict:
|
|
||||||
if "_name" in t and t["_name"] == n:
|
|
||||||
ret.append(t)
|
|
||||||
for k, v in t.items():
|
|
||||||
ret += self._findInTree(v, n)
|
|
||||||
if type(t) is list:
|
|
||||||
for v in t:
|
|
||||||
ret += self._findInTree(v, n)
|
|
||||||
return ret
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user