diff options
author | Steve Holme <steve_holme@hotmail.com> | 2020-02-07 16:51:09 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2020-02-07 21:51:36 +0000 |
commit | 511e0c197ad369ff9dae43d1fdcc65025627e636 (patch) | |
tree | 02741d005825c5e534f1e77f191d5aa8c304c315 /projects | |
parent | feba3f0549af546677ee2d924344234fd91b8f50 (diff) | |
download | curl-511e0c197ad369ff9dae43d1fdcc65025627e636.tar.gz |
checksrc.bat: Fix not being able to run script from the main curl directory
If the script was ran from the main curl directory rather then the
projects directory then the script would simply exit without error:
C:\url> projects\checksrc.bat
The user would either need to change to the projects directory,
explicitly specify the current working directory, or perform a
oneline hacky workaround:
C:\url> cd projects
C:\url\projects> checksrc.bat
C:\url> checksrc.bat %cd%
C:\url> pushd projects & checksrc.bat & popd
Closes #4894
Diffstat (limited to 'projects')
-rw-r--r-- | projects/checksrc.bat | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/projects/checksrc.bat b/projects/checksrc.bat index e2b6b6999..2ca90d033 100644 --- a/projects/checksrc.bat +++ b/projects/checksrc.bat @@ -6,7 +6,7 @@ rem * / __| | | | |_) | | rem * | (__| |_| | _ <| |___ rem * \___|\___/|_| \_\_____| rem * -rem * Copyright (C) 2014 - 2016, Steve Holme, <steve_holme@hotmail.com>. +rem * Copyright (C) 2014 - 2020, Steve Holme, <steve_holme@hotmail.com>. rem * rem * This software is licensed as described in the file COPYING, which rem * you should have received as part of this distribution. The terms @@ -31,6 +31,9 @@ rem *************************************************************************** set CHECK_SRC=TRUE set CHECK_TESTS=TRUE set CHECK_EXAMPLES=TRUE + set SRC_DIR= + set CUR_DIR=%cd% + set ARG0_DIR=%~dp0 :parseArgs if "%~1" == "" goto prerequisites @@ -88,7 +91,22 @@ rem *************************************************************************** ) :configure - if "%SRC_DIR%" == "" set SRC_DIR=.. + if "%SRC_DIR%" == "" ( + rem Are we being executed from the "projects" or main directory? + if "%CUR_DIR%\" == "%ARG0_DIR%" ( + set SRC_DIR=.. + ) else if exist projects ( + if exist docs ( + if exist lib ( + if exist src ( + if exist tests ( + set SRC_DIR=. + ) + ) + ) + ) + ) + ) if not exist "%SRC_DIR%" goto nosrc :start |