Skip to content

Commit

Permalink
split echos
Browse files Browse the repository at this point in the history
  • Loading branch information
InzynierDomu committed May 31, 2024
1 parent cb3b198 commit b7bf6f4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 35 deletions.
40 changes: 25 additions & 15 deletions autodeploy.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ echo check Python
)
) >> "%log_file%" 2>&1

set file_path="pip_show_platformio_info.txt"

echo check Platform IO
(

:: Check if PlatformIO is installed
echo Checking if PlatformIO is installed...
pip show platformio > pip_check.txt
findstr /C:"WARNING: Package(s) not found" pip_check.txt
pip show platformio > %file_path% 2>&1

:: Display the content of the file
echo Displaying the content of the file %file_path%:
type %file_path%

findstr /C:"WARNING: Package(s) not found" %file_path%
if %errorlevel% equ 0 (
echo PlatformIO is not installed. Proceeding with installation...
pip install platformio
Expand All @@ -46,22 +52,21 @@ echo check Platform IO
echo locate Platform IO
(
:: Create a temporary file with the result of the pip show platformio command
pip show platformio > pip_show_platformio_info.txt
pip show platformio > %file_path% 2>&1

:: Set the default location of the text file
set file_path="pip_show_platformio_info.txt"
:: Display the content of the file
echo Displaying the content of the file %file_path%:
type %file_path%

:: Search the text file for the line containing "Location:"
for /f "delims=: tokens=1,*" %%A in ('findstr /n "Location:" "%file_path%"') do (
set "line_number=%%A"
set "location=%%B"
)
for /f "delims=: tokens=1,2" %%A in ('findstr /n "Location: " "%file_path%"') do (
set "line_number=%%A"
set "location=%%B"
)

:: Remove leading and trailing spaces from the location
set "location=%location:~10%"
:: Remove leading and trailing spaces from the location (optional)
set "location=%location:~10%"

:: Output everything after "Location:"
echo Everything after "Location:" in line %line_number%: %location%
echo Everything after Location: %location% in line %line_number%

:: Remove "lib\site-packages" from the location and add "Scripts\platformio.exe"
set "platformio_exe_path=%location:lib\site-packages=Scripts\platformio.exe%"
Expand All @@ -72,8 +77,12 @@ echo locate Platform IO
echo Path to platformio.exe: %platformio_exe_path%
) else (
echo Unable to find platformio.exe file. Check the installation path.
exit
)
)>> "%log_file%" 2>&1

echo Configuring Arduino project and uploading
(
echo Setting the path to the Arduino project...
set project_path=.\

Expand All @@ -89,6 +98,7 @@ echo locate Platform IO
echo Checking if the operation was successful...
if %errorlevel% neq 0 (
echo Error uploading the project.
exit /b %errorlevel%
) else (
echo The project has been successfully uploaded to Arduino.
)
Expand Down
10 changes: 0 additions & 10 deletions pip_check.txt

This file was deleted.

10 changes: 0 additions & 10 deletions pip_show_platformio_info.txt

This file was deleted.

0 comments on commit b7bf6f4

Please sign in to comment.