Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs1-24fa
project03
Commits
9a136dc3
Commit
9a136dc3
authored
8 months ago
by
Adam Blank
Browse files
Options
Download
Email Patches
Plain Diff
Update transfer.py
parent
2c0ac5bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
transfer.py
+9
-4
transfer.py
with
9 additions
and
4 deletions
+9
-4
transfer.py
View file @
9a136dc3
...
@@ -6,15 +6,19 @@ import platform
...
@@ -6,15 +6,19 @@ import platform
import
subprocess
import
subprocess
def
get_windows_drive_name
(
letter
):
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'
:
if
platform
.
system
().
lower
()
==
'windows'
:
disks
=
[(
x
.
mountpoint
,
get_windows_drive_name
(
x
.
mountpoint
.
strip
(
'
\\
'
)))
for
x
in
psutil
.
disk_partitions
()]
disks
=
[(
x
.
mountpoint
,
get_windows_drive_name
(
x
.
mountpoint
.
strip
(
'
\\
'
)))
disks
=
[(
x
,
name
)
for
x
,
name
in
disks
if
'TRINKEY'
in
name
or
'CIRCUIT'
in
name
]
for
x
in
psutil
.
disk_partitions
()]
disks
=
[(
x
,
name
)
for
x
,
name
in
disks
if
'TRINKEY'
in
name
or
'CIRCUIT'
in
name
]
else
:
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
:
if
len
(
disks
)
!=
1
:
print
(
"Could not find the trinkey. Did you click the reset button twice and connect it?"
)
print
(
"Could not find the trinkey. Did you click the reset button twice and connect it?"
)
...
@@ -33,3 +37,4 @@ else:
...
@@ -33,3 +37,4 @@ else:
shutil
.
rmtree
(
os
.
path
.
join
(
'src'
,
'__pycache__'
),
True
)
shutil
.
rmtree
(
os
.
path
.
join
(
'src'
,
'__pycache__'
),
True
)
shutil
.
copytree
(
'src'
,
os
.
path
.
join
(
disk
,
'src'
),
dirs_exist_ok
=
True
)
shutil
.
copytree
(
'src'
,
os
.
path
.
join
(
disk
,
'src'
),
dirs_exist_ok
=
True
)
shutil
.
copy
(
'code.py'
,
os
.
path
.
join
(
disk
,
'code.py'
))
shutil
.
copy
(
'code.py'
,
os
.
path
.
join
(
disk
,
'code.py'
))
print
(
"Done! Switch back to the Serial Monitor!"
)
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help