mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 00:56:01 +08:00
Fix OSXRemovableDevicePlugin so it works properly on OSX
This commit is contained in:
parent
543c58d57a
commit
26aa78c3b9
@ -13,8 +13,8 @@ import os
|
|||||||
import plistlib
|
import plistlib
|
||||||
|
|
||||||
## Support for removable devices on Mac OSX
|
## Support for removable devices on Mac OSX
|
||||||
class OSXRemovableDrives(RemovableDrivePlugin.RemovableDrivePlugin):
|
class OSXRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
|
||||||
def run(self):
|
def checkRemovableDrives(self):
|
||||||
drives = {}
|
drives = {}
|
||||||
p = subprocess.Popen(["system_profiler", "SPUSBDataType", "-xml"], stdout=subprocess.PIPE)
|
p = subprocess.Popen(["system_profiler", "SPUSBDataType", "-xml"], stdout=subprocess.PIPE)
|
||||||
plist = plistlib.loads(p.communicate()[0])
|
plist = plistlib.loads(p.communicate()[0])
|
||||||
@ -41,6 +41,8 @@ class OSXRemovableDrives(RemovableDrivePlugin.RemovableDrivePlugin):
|
|||||||
volume = vol["mount_point"]
|
volume = vol["mount_point"]
|
||||||
drives[volume] = os.path.basename(volume)
|
drives[volume] = os.path.basename(volume)
|
||||||
|
|
||||||
|
return drives
|
||||||
|
|
||||||
def performEjectDevice(self, device):
|
def performEjectDevice(self, device):
|
||||||
p = subprocess.Popen(["diskutil", "eject", path], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(["diskutil", "eject", path], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
output = p.communicate()
|
output = p.communicate()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user