Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Commit

Permalink
add windows version
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Perndorfer committed Nov 3, 2018
1 parent 9f5f56d commit dd1e578
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ You current working dir is *not* modified, so you can fire any command without l
## Installation

1. Clone or download this repo
1. `chmod u+x ybp`
1. put `ybp` somehwere on your `PATH`
1. Never type `cd ../../../hybris/bin/platform` or `source setantenv.sh` again
1. `chmod u+x ybp` (Linux / macOS only)
1. put `ybp` / `ybp.bat` somehwere on your `PATH`
1. Never type `cd ../../../hybris/bin/platform` or `source setantenv.sh` / `setantenv.bat` again

## Examples

Expand Down
32 changes: 32 additions & 0 deletions ybp.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@setlocal ENABLEEXTENSIONS

@set current=%cd%
@for /F %%I in ("%current%") do @set root=%%~dI

:loop
@if EXIST "%current%\hybris\bin\platform\*" (
@set platform=%current%\hybris\bin\platform
)
@call :dirname "%current%" current
@IF NOT DEFINED platform IF NOT "%current%"=="%root%" goto :loop

@IF DEFINED platform (
@cd "%platform%"
@IF "%1"=="ant" (
@call setantenv.bat
)
@%COMSPEC% /c %*
) ELSE (
echo Could not find hybris/bin/platform folder, will NOT execute '%*' 1>&2
@EXIT /B 1
)

@endlocal
@goto:EOF

:dirname file varName
@setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
@SET _dir=%~dp1
@SET _dir=%_dir:~0,-1%
@endlocal & set %2=%_dir%
@goto:EOF

0 comments on commit dd1e578

Please sign in to comment.