Skip to content

Commit

Permalink
Use %* instead of loop in .bat scripts. (#4814)
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 2552fa9)

# Conflicts:
#	tools/fastdds/fastdds.bat
#	tools/fastdds/ros-discovery.bat
  • Loading branch information
MiguelCompany authored and mergify[bot] committed May 21, 2024
1 parent 60b6242 commit ed6d826
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
20 changes: 11 additions & 9 deletions tools/fastdds/fastdds.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
setlocal

set dir=%~dp0
set args=%1

:getarg
shift
if "%~1"=="" goto continue
set args=%args% %1
goto getarg

:continue

:: Check python
py --list > NUL 2>&1
Expand All @@ -22,10 +13,21 @@ if not %ERRORLEVEL%==0 (
)

:: Python version in the form "Major.Minor"
<<<<<<< HEAD
if %PYTHON_VERSION%=="" (
echo error retrieving python version. Please, make sure python is installed and accessible.
exit /B 65
)
=======
if not "%PYTHON_VERSION%" == "" (
:: Use launcher to profit from shebang hints on fastdds.py
:: Select the correct python version to source the appropriate paths
py -%PYTHON_VERSION% "%dir%\..\tools\fastdds\fastdds.py" %*
) else (
:: Use launcher to profit from shebang hints on fastdds.py
:: Select latest available python version
py "%dir%\..\tools\fastdds\fastdds.py" %*
>>>>>>> 2552fa9cd (Use `%*` instead of loop in `.bat` scripts. (#4814))
)

:: Use launcher to profit from shebang hints on fastdds.py
Expand Down
20 changes: 11 additions & 9 deletions tools/fastdds/ros-discovery.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
setlocal

set dir=%~dp0
set args=%1

:getarg
shift
if "%~1"=="" goto continue
set args=%args% %1
goto getarg

:continue

:: Check python
py --list > NUL 2>&1
Expand All @@ -22,10 +13,21 @@ if not %ERRORLEVEL%==0 (
)

:: Python version in the form "Major.Minor"
<<<<<<< HEAD
if %PYTHON_VERSION%=="" (
echo error retrieving python version. Please, make sure python is installed and accessible.
exit /B 65
)
=======
if not "%PYTHON_VERSION%" == "" (
:: Use launcher to profit from shebang hints on fastdds.py
:: Select the correct python version to source the appropriate paths
py -%PYTHON_VERSION% "%dir%\..\tools\fastdds\fastdds.py" discovery %*
) else (
:: Use launcher to profit from shebang hints on fastdds.py
:: Select latest available python version
py "%dir%\..\tools\fastdds\fastdds.py" discovery %*
>>>>>>> 2552fa9cd (Use `%*` instead of loop in `.bat` scripts. (#4814))
)

:: Use launcher to profit from shebang hints on fastdds.py
Expand Down

0 comments on commit ed6d826

Please sign in to comment.