Commit 9a136dc3 authored by Adam Blank's avatar Adam Blank
Browse files

Update transfer.py

parent 2c0ac5bd
No related merge requests found
Showing with 9 additions and 4 deletions
+9 -4
......@@ -6,15 +6,19 @@ import platform
import subprocess
def get_windows_drive_name(letter):
return subprocess.check_output(["cmd","/c vol " + letter]).decode().split("\r\n")[0].split(" ").pop()
return subprocess.check_output(["cmd", "/c vol " + letter]).decode().split("\r\n")[0].split(" ").pop()
if platform.system().lower() == 'windows':
disks = [(x.mountpoint, get_windows_drive_name(x.mountpoint.strip('\\'))) for x in psutil.disk_partitions()]
disks = [(x, name) for x, name in disks if 'TRINKEY' in name or 'CIRCUIT' in name]
disks = [(x.mountpoint, get_windows_drive_name(x.mountpoint.strip('\\')))
for x in psutil.disk_partitions()]
disks = [(x, name)
for x, name in disks if 'TRINKEY' in name or 'CIRCUIT' in name]
else:
disks = [(x.mountpoint, x.mountpoint) for x in psutil.disk_partitions() if 'TRINKEY' in x.mountpoint.upper() or 'CIRCUIT' in x.mountpoint.upper()]
disks = [(x.mountpoint, x.mountpoint) for x in psutil.disk_partitions(
) if 'TRINKEY' in x.mountpoint.upper() or 'CIRCUIT' in x.mountpoint.upper()]
if len(disks) != 1:
print("Could not find the trinkey. Did you click the reset button twice and connect it?")
......@@ -33,3 +37,4 @@ else:
shutil.rmtree(os.path.join('src', '__pycache__'), True)
shutil.copytree('src', os.path.join(disk, 'src'), dirs_exist_ok=True)
shutil.copy('code.py', os.path.join(disk, 'code.py'))
print("Done! Switch back to the Serial Monitor!")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment