From 4c6e17c650c07ec69af45de8f6257d851562357a Mon Sep 17 00:00:00 2001 From: Henrik Fehlauer Date: Thu, 30 May 2019 23:52:59 +0200 Subject: [PATCH] Allow to run server.cmd from source directory This also enables launching server.cmd from arbitrary directories to match the behaviour of server.sh. --- README.md | 6 ++++++ misc/scripts/standalone/server.cmd | 31 ++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4b33bad..290c09f 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,12 @@ Next, download one or more [data file(s)](http://brouter.de/brouter/segments4/) On Linux: > ./misc/scripts/standalone/server.sh +On Windows (using Bash): +> ./misc/scripts/standalone/server.sh + +On Windows (using CMD): +> misc\scripts\standalone\server.cmd + Related Projects ================ diff --git a/misc/scripts/standalone/server.cmd b/misc/scripts/standalone/server.cmd index d26c2c3..dc35e9c 100644 --- a/misc/scripts/standalone/server.cmd +++ b/misc/scripts/standalone/server.cmd @@ -3,8 +3,35 @@ REM BRouter standalone server REM java -cp brouter.jar btools.brouter.RouteServer +pushd %~dp0 + REM maxRunningTime is the request timeout in seconds, set to 0 to disable timeout set JAVA_OPTS=-Xmx128M -Xms128M -Xmn8M -DmaxRunningTime=300 -set CLASSPATH=../brouter.jar -java %JAVA_OPTS% -cp %CLASSPATH% btools.server.RouteServer ..\segments4 ..\profiles2 ..\customprofiles 17777 1 +REM First search in locations matching the directory structure as found in the official BRouter zip archive +set CLASSPATH=../brouter.jar +set SEGMENTSPATH=..\segments4 +set PROFILESPATH=..\profiles2 +set CUSTOMPROFILESPATH=..\customprofiles + +REM Otherwise try to locate files inside the source checkout +if not exist "%CLASSPATH%" ( + for /f "tokens=*" %%w in ( + 'where /R ..\..\..\brouter-server\target brouter-server*-jar-with-dependencies.jar' + ) do ( + set CLASSPATH=%%w + ) +) +if not exist "%SEGMENTSPATH%" ( + set SEGMENTSPATH=..\..\segments4 +) +if not exist "%PROFILESPATH%" ( + set PROFILESPATH=..\..\profiles2 +) +if not exist "%CUSTOMPROFILESPATH%" ( + set CUSTOMPROFILESPATH=..\..\customprofiles +) + +java %JAVA_OPTS% -cp %CLASSPATH% btools.server.RouteServer "%SEGMENTSPATH%" "%PROFILESPATH%" "%CUSTOMPROFILESPATH%" 17777 1 + +popd