Skip to content

Commit

Permalink
msi: refactor fluentd.bat
Browse files Browse the repository at this point in the history
* Remove unnecessary enabledelayedexpansion
* Remove unnecessary `/`
* Make FLUENT_PACKAGE_VERSION local

Signed-off-by: Daijiro Fukuda <[email protected]>
  • Loading branch information
daipom committed Jun 25, 2024
1 parent 02db3f5 commit ce3fbf3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions fluent-package/msi/assets/fluentd.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ if "%~nx0" == "td-agent.bat" (
)

@rem Convert path separator from backslash to forwardslash
setlocal enabledelayedexpansion
set FLUENT_PACKAGE_TOPDIR=!FLUENT_PACKAGE_TOPDIR:\=/!
set FLUENT_PACKAGE_TOPDIR=%FLUENT_PACKAGE_TOPDIR:\=/%

set PATH=%FLUENT_PACKAGE_TOPDIR%bin;%PATH%
set PATH=%FLUENT_PACKAGE_TOPDIR%;%PATH%
set "FLUENT_CONF=%FLUENT_PACKAGE_TOPDIR%/etc/fluent/fluentd.conf"
set "FLUENT_PLUGIN=%FLUENT_PACKAGE_TOPDIR%/etc/fluent/plugin"
set "FLUENT_PACKAGE_VERSION=%FLUENT_PACKAGE_TOPDIR%/bin/fluent-package-version.rb"
set "FLUENT_CONF=%FLUENT_PACKAGE_TOPDIR%etc/fluent/fluentd.conf"
set "FLUENT_PLUGIN=%FLUENT_PACKAGE_TOPDIR%etc/fluent/plugin"

setlocal
set "FLUENT_PACKAGE_VERSION=%FLUENT_PACKAGE_TOPDIR%bin/fluent-package-version.rb"
for %%p in (%*) do (
if "%%p"=="--version" (
ruby "%FLUENT_PACKAGE_VERSION%"
goto last
)
)
"%FLUENT_PACKAGE_TOPDIR%/bin/fluentd" %*
endlocal

"%FLUENT_PACKAGE_TOPDIR%bin/fluentd" %*

:last

0 comments on commit ce3fbf3

Please sign in to comment.