8000 MassStorageCopy updated to manage several node names. · stm32duino/Arduino_Tools@ca8aa8c · GitHub
[go: up one dir, main page]

Skip to content

Commit ca8aa8c

Browse files
committed
MassStorageCopy updated to manage several node names.
Depending of the board revision, mount point name could be different. Ex for: STM32F030R8 with a rev 1 node name is : "NUCLEO" while it is "NODE_F030R8" for rev c Ex: in boards.txt we could have: Nucleo_64.menu.Nucleo_64_board.NUCLEO_F030R8.node="NODE_F030R8,NUCLEO" Fix #6 Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 1ba6db2 commit ca8aa8c

File tree

2 files changed

+36
-13
lines changed

2 files changed

+36
-13
lines changed

src/massStorageCopy/massStorageCopy.bat

Lines changed: 0 additions & 9 deletions
This file was deleted.

win/massStorageCopy.bat

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,41 @@
11
@ECHO off
2+
3+
REM Exit codes for xcopy
4+
REM code | Description
5+
REM 0 | Files were copied without error.
6+
REM 1 | No files were found to copy.
7+
REM 2 | The user pressed CTRL+C to terminate xcopy.
8+
REM 4 | Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line.
9+
REM 5 | Disk write error occurred.
10+
211
SET SOURCE=%2
312
SET SRC_PARSE=%SOURCE:/=\%
413
SET TARGET=%4
14+
SET TARGET=%TARGET:\=%
15+
516
setlocal enabledelayedexpansion
6-
for /F "skip=1 tokens=*" %%a in ('WMIC LOGICALDISK where "volumename like '%TARGET%%%'" get deviceid') do if not defined id set id=%%a
7-
Call Set "deviceid=%%id: =%%"
8-
if not "%deviceid%" == "" (XCOPY %SRC_PARSE% %deviceid% /Y /Q >NUL
9-
echo Upload complete ) else ( echo %TARGET% not found. Please ensure the device is correctly connected)
17+
call :parse %TARGET%
18+
if !errorlevel! == 7 (echo %TARGET% not found. Please ensure the device is correctly connected.)
19+
exit /b !errorlevel!
20+
21+
:parse
22+
setlocal enabledelayedexpansion
23+
set list=%1
24+
set list=%list:"=%
25+
26+
for /f "tokens=1* delims=," %%a in ("%list%") DO (
27+
if not "%%a" == "" call :sub %%a
28+
if !errorlevel! LEQ 5 (exit /b !errorlevel!)
29+
if not "%%b" == "" (call :parse "%%b")
30+
)
31+
exit /b !errorlevel!
32+
33+
:sub
34+
setlocal enabledelayedexpansion
35+
for /F "skip=1 tokens=*" %%a in ('WMIC LOGICALDISK where "volumename like '%1'" get deviceid 2^>NUL') do if not defined id set id=%%a
36+
call Set "deviceid=%%id: =%%"
37+
if not "%deviceid%" == "" (
38+
XCOPY %SRC_PARSE% %deviceid% /Y /Q
39+
if !errorlevel! == 0 (echo Upload complete on %1 ^(%deviceid%^))
40+
exit /b !errorlevel!)
41+
exit /b 7

0 commit comments

Comments
 (0)
0