You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bh...@apache.org on 2014/01/31 05:35:12 UTC

[1/2] webworks commit: CB-5909 Fixed issue where check-reqs skipped checking logic on second pass-through - Removed dependency on npm in init scripts when modules exist - Skip logic if _BOTH_ variables are set

Updated Branches:
  refs/heads/master 171c8f9a2 -> 044913849


CB-5909 Fixed issue where check-reqs skipped checking logic on second pass-through
- Removed dependency on npm in init scripts when modules exist
- Skip logic if _BOTH_ variables are set


Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/ae20ff58
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/ae20ff58
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/ae20ff58

Branch: refs/heads/master
Commit: ae20ff58c588b21e2b0b1bba11fc29a46c90c7a6
Parents: 171c8f9
Author: jkeshavarzi <jk...@blackberry.com>
Authored: Mon Jan 27 18:27:07 2014 -0500
Committer: Bryan Higgins <br...@bryanhiggins.net>
Committed: Thu Jan 30 23:32:31 2014 -0500

----------------------------------------------------------------------
 blackberry10/bin/init     | 76 ++++++++++++++++++++++--------------------
 blackberry10/bin/init.bat | 20 ++++++-----
 2 files changed, 51 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/ae20ff58/blackberry10/bin/init
----------------------------------------------------------------------
diff --git a/blackberry10/bin/init b/blackberry10/bin/init
index faabe6e..212a85c 100755
--- a/blackberry10/bin/init
+++ b/blackberry10/bin/init
@@ -12,7 +12,7 @@
 
        Unless required by applicable law or agreed to in writing,
        software distributed under the License is distributed on an
-       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
        KIND, either express or implied.  See the License for the
        specific language governing permissions and limitations
        under the License.
@@ -23,7 +23,7 @@ LOCAL_NODE_BIN=$CORDOVA_HOME_DIR/bin/dependencies/node/bin
 LOCAL_BBTOOLS=$CORDOVA_HOME_DIR/bin/dependencies/bb-tools/bin
 
 #Skip all logic if init has already been run (env variable have been set already...)
-if [ -z "$CORDOVA_NODE" ] && [ -z "$CORDOVA_BBTOOLS" ]; then
+if [ -z "$CORDOVA_NODE" ] || [ -z "$CORDOVA_BBTOOLS" ]; then
 
     #set CORDOVA_NODE
     if [ -x "$LOCAL_NODE_BIN" ]; then
@@ -51,42 +51,44 @@ if [ -z "$CORDOVA_NODE" ] && [ -z "$CORDOVA_BBTOOLS" ]; then
     fi
     export CORDOVA_BBTOOLS=$CORDOVA_BBTOOLS
 
-    #-------------check reqs---------------#
-    NODE="$CORDOVA_NODE/node"
-    NPM="$CORDOVA_NODE/npm"
-    JAVA=$(command -v java)
-    PACKAGER="$CORDOVA_BBTOOLS/blackberry-nativepackager"
-    DEPLOYER="$CORDOVA_BBTOOLS/blackberry-deploy"
-    SIGNER="$CORDOVA_BBTOOLS/blackberry-signer"
-    DEBUGTOKENREQUEST="$CORDOVA_BBTOOLS/blackberry-debugtokenrequest"
+fi
 
-    if [ ! -x "$NODE" ]; then
-        echo node cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    elif [ ! -x "$LOCAL_NODE_BIN" ] && [ ! -x "$NPM" ]; then
-        echo npm cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    elif [ ! -x "$JAVA" ]; then
-        echo java cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    elif [ ! -x "$PACKAGER" ]; then
-        echo blackberry-nativepackager cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    elif [ ! -x "$DEPLOYER" ]; then
-        echo blackberry-deploy cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    elif [ ! -x "$SIGNER" ]; then
-        echo blackberry-signer cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    elif [ ! -x "$DEBUGTOKENREQUEST" ]; then
-        echo blackberry-debugtokenrequest cannot be found on the path. Aborting.
-        EXIT_CODE=2
-    else
-        "$NODE" "$CURRENT_DIR/check_reqs.js" "$@"
-    fi
+#-------------check reqs---------------#
+NODE="$CORDOVA_NODE/node"
+NPM="$CORDOVA_NODE/npm"
+JAVA=$(command -v java)
+PACKAGER="$CORDOVA_BBTOOLS/blackberry-nativepackager"
+DEPLOYER="$CORDOVA_BBTOOLS/blackberry-deploy"
+SIGNER="$CORDOVA_BBTOOLS/blackberry-signer"
+DEBUGTOKENREQUEST="$CORDOVA_BBTOOLS/blackberry-debugtokenrequest"
+NPM_PACKAGE_JSON="$BIN_DIR"/../package.json
 
-    if [ ! -z "$EXIT_CODE" ]; then
-        exit $EXIT_CODE
-    fi
+if [ ! -x "$NODE" ]; then
+    echo node cannot be found on the path. Aborting.
+    EXIT_CODE=2
+elif [ ! -x "$LOCAL_NODE_BIN" ] && [ ! -x "$NPM" ] && [ -e "$NPM_PACKAGE_JSON" ]; then
+    echo npm cannot be found on the path. Aborting.
+    EXIT_CODE=2
+elif [ ! -x "$JAVA" ]; then
+    echo java cannot be found on the path. Aborting.
+    EXIT_CODE=2
+elif [ ! -x "$PACKAGER" ]; then
+    echo blackberry-nativepackager cannot be found on the path. Aborting.
+    EXIT_CODE=2
+elif [ ! -x "$DEPLOYER" ]; then
+    echo blackberry-deploy cannot be found on the path. Aborting.
+    EXIT_CODE=2
+elif [ ! -x "$SIGNER" ]; then
+    echo blackberry-signer cannot be found on the path. Aborting.
+    EXIT_CODE=2
+elif [ ! -x "$DEBUGTOKENREQUEST" ]; then
+    echo blackberry-debugtokenrequest cannot be found on the path. Aborting.
+    EXIT_CODE=2
+else
+    "$NODE" "$CURRENT_DIR/check_reqs.js" "$@"
+fi
+
+if [ ! -z "$EXIT_CODE" ]; then
+    exit $EXIT_CODE
 fi
 

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/ae20ff58/blackberry10/bin/init.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/init.bat b/blackberry10/bin/init.bat
index a67bbb7..b90e871 100644
--- a/blackberry10/bin/init.bat
+++ b/blackberry10/bin/init.bat
@@ -83,13 +83,19 @@ if exist "%LOCAL_BBTOOLS_BINARY%" (
     )
 )
 
-if not exist "%LOCAL_NODE_BINARY%" && not exist "%CORDOVA_NODE%\node.exe" (
-  echo node cannot be found on the path. Aborting.
-  exit /b 2
+:end
+
+if not exist "%LOCAL_NODE_BINARY%" (
+  if not exist "%CORDOVA_NODE%\node.exe" (
+    echo node cannot be found on the path. Aborting.
+    exit /b 2
+  )
 )
-if not exist "%CORDOVA_NODE%\npm" (
-  echo npm cannot be found on the path. Aborting.
-  exit /b 2
+if exist "%~dp0..\package.json" (
+  if not exist "%CORDOVA_NODE%\npm" (
+    echo npm cannot be found on the path. Aborting.
+    exit /b 2
+  )
 )
 if not defined FOUNDJAVA (
   echo java cannot be found on the path. Aborting.
@@ -114,6 +120,4 @@ if not exist "%CORDOVA_BBTOOLS%\blackberry-debugtokenrequest.bat" (
 
 "%CORDOVA_NODE%\node" "%~dp0\check_reqs.js" %*
 
-:end
-
 exit /b 0


[2/2] webworks commit: CB-5660 use enabledelayedexpansion to handle )s in path

Posted by bh...@apache.org.
CB-5660 use enabledelayedexpansion to handle )s in path

Refactoring file finding to a separate script which is mostly only used on WinXP
- it also needs to be copied by create.js

Avoid using %~...s in favor of relying on quotes


Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/04491384
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/04491384
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/04491384

Branch: refs/heads/master
Commit: 0449138496a5bd1659f7d9cd81cc75b2289cc5a5
Parents: ae20ff5
Author: Josh Soref <js...@blackberry.com>
Authored: Mon Dec 16 16:50:08 2013 -0500
Committer: Bryan Higgins <br...@bryanhiggins.net>
Committed: Thu Jan 30 23:34:10 2014 -0500

----------------------------------------------------------------------
 blackberry10/bin/check_reqs.bat                 |   7 +-
 blackberry10/bin/create.bat                     |   4 +-
 blackberry10/bin/create.js                      |   1 +
 blackberry10/bin/init.bat                       | 122 ++++++++++---------
 blackberry10/bin/target.bat                     |   4 +-
 .../project/cordova/bb10-ndk-version.bat        |   4 +-
 .../bin/templates/project/cordova/build.bat     |   4 +-
 .../bin/templates/project/cordova/clean.bat     |   4 +-
 .../project/cordova/install-device.bat          |   4 +-
 .../project/cordova/install-emulator.bat        |   4 +-
 .../project/cordova/lib/list-devices.bat        |   2 +-
 .../cordova/lib/list-emulator-images.bat        |   2 +-
 .../cordova/lib/list-started-emulators.bat      |   2 +-
 .../bin/templates/project/cordova/run.bat       |   4 +-
 .../bin/templates/project/cordova/version.bat   |   4 +-
 blackberry10/bin/update.bat                     |   4 +-
 blackberry10/bin/whereis.cmd                    |  19 +++
 17 files changed, 111 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/check_reqs.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/check_reqs.bat b/blackberry10/bin/check_reqs.bat
index c25beb1..0de7c75 100755
--- a/blackberry10/bin/check_reqs.bat
+++ b/blackberry10/bin/check_reqs.bat
@@ -18,11 +18,6 @@ goto comment
        under the License.
 :comment
 
-set INITCALL="%~dps0init"
-if not exist INITCALL (
-    set INITCALL="%~dp0init"
-)
-
-call %INITCALL%
+call "%~dp0init"
 if ERRORLEVEL 1 exit /B %ERRORLEVEL%
 

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/create.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/create.bat b/blackberry10/bin/create.bat
index 428d01b..f2f3998 100644
--- a/blackberry10/bin/create.bat
+++ b/blackberry10/bin/create.bat
@@ -17,13 +17,13 @@ goto comment
        specific language governing permissions and limitations
        under the License.
 :comment
-set BIN_DIR=%~dp0
+set "BIN_DIR=%~dp0"
 
 call "%BIN_DIR%init"
 if ERRORLEVEL 1 exit /B %ERRORLEVEL% 
 
 if exist "%BIN_DIR%..\package.json" (
-    pushd %BIN_DIR%..
+    pushd "%BIN_DIR%.."
     call "%CORDOVA_NODE%\npm" install
     if ERRORLEVEL 1 exit /B 1
     popd

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/create.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/create.js b/blackberry10/bin/create.js
index 30766bf..4940f3f 100644
--- a/blackberry10/bin/create.js
+++ b/blackberry10/bin/create.js
@@ -129,6 +129,7 @@ function copyFilesToProject() {
     utils.copyFile(path.join(BIN_DIR, "lib", "signing-utils.js"), path.join(project_path, "cordova", "lib"));
 
     // copy repo level init script to project
+    utils.copyFile(path.join(BIN_DIR, "whereis.cmd"), path.join(project_path, "cordova"));
     utils.copyFile(path.join(BIN_DIR, "init.bat"), path.join(project_path, "cordova"));
     utils.copyFile(path.join(BIN_DIR, "init"), path.join(project_path, "cordova"));
 

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/init.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/init.bat b/blackberry10/bin/init.bat
index b90e871..d7fe0bd 100644
--- a/blackberry10/bin/init.bat
+++ b/blackberry10/bin/init.bat
@@ -17,70 +17,71 @@ goto comment
        specific language governing permissions and limitations
        under the License.
 :comment
+setlocal enabledelayedexpansion
 
-set /P CORDOVA_VERSION=<%~dps0..\VERSION
-set CORDOVA_HOME_DIR=%USERPROFILE%\.cordova\lib\blackberry10\cordova\%CORDOVA_VERSION%
-set LOCAL_NODE_BINARY=%CORDOVA_HOME_DIR%\bin\dependencies\node\bin
-set LOCAL_BBTOOLS_BINARY=%CORDOVA_HOME_DIR%\bin\dependencies\bb-tools\bin
+set /P CORDOVA_VERSION=<"%~dp0..\VERSION"
+set "CORDOVA_HOME_DIR=!USERPROFILE!\.cordova\lib\blackberry10\cordova\!CORDOVA_VERSION!"
+set "LOCAL_NODE_BINARY=!CORDOVA_HOME_DIR!\bin\dependencies\node\bin"
+set "LOCAL_BBTOOLS_BINARY=!CORDOVA_HOME_DIR!\bin\dependencies\bb-tools\bin"
 
-set FOUNDJAVA=
-for %%e in (%PATHEXT%) do (
-  for %%X in (java%%e) do (
-    if not defined FOUNDJAVA (
-      set FOUNDJAVA=%%~$PATH:X
-    )
-  )
+set FOUNDWHERE=
+for /f "usebackq delims=" %%e in (`where where 2^>nul`) do (
+  if not defined FOUNDWHERE set "FOUNDWHERE=%%e"
 )
-if not defined FOUNDJAVA (
-  set JAVAPATH="%ProgramFiles(x86)%\java\jre7\bin;%ProgramW6432%\java\jre7\bin;"
-  for %%e in (%PATHEXT%) do (
-    for %%X in (java%%e) do (
-      if not defined FOUNDJAVAAT (
-        set FOUNDJAVAAT=%%~dp$JAVAPATH:X
-      )
+if not defined FOUNDWHERE set "FOUNDWHERE=%~dp0\whereis"
+
+set FOUNDJAVAAT=
+for /f "usebackq delims=" %%e in (`"%FOUNDWHERE%" java 2^>nul`) do (
+  if not defined FOUNDJAVAAT set "FOUNDJAVAAT=%%~dpe"
+)
+:: While we could normally ask where.exe to search an arbitrary environment variable,
+:: it's too complicated to teach whereis.cmd to do that
+:: instead we're going to replace PATH with a special PATH
+:: In case you're curious, you can't nest ::'s inside ()s
+if not defined FOUNDJAVAAT (
+  setlocal enabledelayedexpansion
+  SET "PATH=%ProgramFiles(x86)%\java\jre7\bin;%ProgramW6432%\java\jre7\bin;"
+  for /f "usebackq delims=" %%e in (`"%FOUNDWHERE%" java 2^>nul`) do (
+    set "FOUNDJAVAAT=%%~dpe"
+  )
+  if defined FOUNDJAVAAT (
+    for /f "delims=" %%C in (""!FOUNDJAVAAT!"") do (
+      endlocal
+      set "FOUNDJAVAAT=%%~C"
+    )
+    if defined FOUNDJAVAAT (
+      set "PATH=!PATH!;!FOUNDJAVAAT!"
     )
+  ) else (
+    endlocal
   )
 )
-if defined FOUNDJAVAAT (
-  set PATH=%PATH%;%FOUNDJAVAAT%
-)
+:: While there are two endlocal calls, they're mutually exclusive and bookend the setlocal
 
 if defined CORDOVA_NODE (
-    if exist "%CORDOVA_NODE%" (
-        if defined CORDOVA_BBTOOLS (
-            if exist "%CORDOVA_BBTOOLS%" (
-                goto end
-            )
-        )
+  if exist "!CORDOVA_NODE!" (
+    if defined CORDOVA_BBTOOLS (
+      if exist "!CORDOVA_BBTOOLS!" (
+        goto end
+      )
     )
+  )
 )
 
-if exist "%LOCAL_NODE_BINARY%" (
-    set CORDOVA_NODE=%LOCAL_NODE_BINARY%
+if exist "!LOCAL_NODE_BINARY!" (
+  set "CORDOVA_NODE=!LOCAL_NODE_BINARY!"
 ) else (
-    set FOUNDNODE=
-    for %%e in (%PATHEXT%) do (
-        for %%X in (node%%e) do (
-            if not defined FOUNDNODE (
-                set FOUNDNODE=%%~$PATH:X
-                for %%F in ("%%~$PATH:X") do set CORDOVA_NODE=%%~dpF
-            )
-        )
-    )
+  for /f "usebackq delims=" %%e in (`%FOUNDWHERE% node 2^>nul`) do (
+    set "CORDOVA_NODE=%%~dpe"
+  )
 )
 
-if exist "%LOCAL_BBTOOLS_BINARY%" (
-    set CORDOVA_BBTOOLS=%LOCAL_BBTOOLS_BINARY%
+if exist "!LOCAL_BBTOOLS_BINARY!" (
+  set "CORDOVA_BBTOOLS=!LOCAL_BBTOOLS_BINARY!"
 ) else (
-    set FOUNDBBTOOLS=
-    for %%e in (%PATHEXT%) do (
-        for %%X in (blackberry-nativepackager%%e) do (
-            if not defined FOUNDBBTOOLS (
-                set FOUNDBBTOOLS=%%~$PATH:X
-                for %%F in ("%%~$PATH:X") do set CORDOVA_BBTOOLS=%%~dpF
-            )
-        )
-    )
+  for /f "usebackq delims=" %%e in (`%FOUNDWHERE% blackberry-nativepackager 2^>nul`) do (
+    set "CORDOVA_BBTOOLS=%%~dpe"
+  )
 )
 
 :end
@@ -97,27 +98,38 @@ if exist "%~dp0..\package.json" (
     exit /b 2
   )
 )
-if not defined FOUNDJAVA (
+if not defined FOUNDJAVAAT (
   echo java cannot be found on the path. Aborting.
   exit /b 2
 )
-if not exist "%CORDOVA_BBTOOLS%\blackberry-nativepackager.bat" (
+if not exist "!CORDOVA_BBTOOLS!\blackberry-nativepackager.bat" (
   echo blackberry-nativepackager cannot be found on the path. Aborting.
   exit /b 2
 )
-if not exist "%CORDOVA_BBTOOLS%\blackberry-deploy.bat" (
+if not exist "!CORDOVA_BBTOOLS!\blackberry-deploy.bat" (
   echo blackberry-deploy cannot be found on the path. Aborting.
   exit /b 2
 )
-if not exist "%CORDOVA_BBTOOLS%\blackberry-signer.bat" (
+if not exist "!CORDOVA_BBTOOLS!\blackberry-signer.bat" (
   echo blackberry-signer cannot be found on the path. Aborting.
   exit /b 2
 )
-if not exist "%CORDOVA_BBTOOLS%\blackberry-debugtokenrequest.bat" (
+if not exist "!CORDOVA_BBTOOLS!\blackberry-debugtokenrequest.bat" (
   echo blackberry-debugtokenrequest cannot be found on the path. Aborting.
   exit /b 2
 )
 
-"%CORDOVA_NODE%\node" "%~dp0\check_reqs.js" %*
+"!CORDOVA_NODE!\node" "%~dp0\check_reqs.js" %*
 
+:: Export variables we want to share with the caller
+for /f "delims=" %%A in (""!CORDOVA_NODE!"") do (
+  for /f "delims=" %%B in (""!CORDOVA_BBTOOLS!"") do (
+    for /f "delims=" %%C in (""!PATH!"") do (
+      endlocal
+      set "CORDOVA_NODE=%%~A"
+      set "CORDOVA_BBTOOLS=%%~B"
+      set "PATH=%%~C"
+    )
+  )
+)
 exit /b 0

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/target.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/target.bat b/blackberry10/bin/target.bat
index 2a5c028..b760775 100755
--- a/blackberry10/bin/target.bat
+++ b/blackberry10/bin/target.bat
@@ -17,7 +17,7 @@ goto comment
        specific language governing permissions and limitations
        under the License.
 :comment
-call "%~dps0init"
+call "%~dp0init"
 if ERRORLEVEL 1 exit /B 1
 
-"%CORDOVA_NODE%\node.exe" "%~dps0\lib\target" %*
+"%CORDOVA_NODE%\node.exe" "%~dp0\lib\target" %*

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/templates/project/cordova/bb10-ndk-version.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/bb10-ndk-version.bat b/blackberry10/bin/templates/project/cordova/bb10-ndk-version.bat
index 5414d9c..00d113c 100644
--- a/blackberry10/bin/templates/project/cordova/bb10-ndk-version.bat
+++ b/blackberry10/bin/templates/project/cordova/bb10-ndk-version.bat
@@ -17,5 +17,5 @@ goto comment
        specific language governing permissions and limitations
        under the License.
 :comment
-call "%~dps0init"
-"%CORDOVA_NODE%\node.exe" "%~dps0\lib\bb10-ndk-version" %*
+call "%~dp0init"
+"%CORDOVA_NODE%\node.exe" "%~dp0\lib\bb10-ndk-version" %*

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/templates/project/cordova/build.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/build.bat b/blackberry10/bin/templates/project/cordova/build.bat
index 305cd4a..e20e8c5 100755
--- a/blackberry10/bin/templates/project/cordova/build.bat
+++ b/blackberry10/bin/templates/project/cordova/build.bat
@@ -17,7 +17,7 @@ goto comment
        specific language governing permissions and limitations
        under the License.
 :comment
-call "%~dps0init"
+call "%~dp0init"
 if ERRORLEVEL 1 exit /B 1
 
-"%CORDOVA_NODE%\node.exe" "%~dps0\lib\build" %*
+"%CORDOVA_NODE%\node.exe" "%~dp0\lib\build" %*

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/templates/project/cordova/clean.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/clean.bat b/blackberry10/bin/templates/project/cordova/clean.bat
index 705edbf..30129a6 100755
--- a/blackberry10/bin/templates/project/cordova/clean.bat
+++ b/blackberry10/bin/templates/project/cordova/clean.bat
@@ -17,7 +17,7 @@ goto comment
        specific language governing permissions and limitations
        under the License.
 :comment
-call "%~dps0init"
+call "%~dp0init"
 if ERRORLEVEL 1 exit /B 1
 
-"%CORDOVA_NODE%\node.exe" "%~dps0\lib\clean" %*
+"%CORDOVA_NODE%\node.exe" "%~dp0\lib\clean" %*

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/templates/project/cordova/install-device.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/install-device.bat b/blackberry10/bin/templates/project/cordova/install-device.bat
index 52d20f6..63c9fec 100755
--- a/blackberry10/bin/templates/project/cordova/install-device.bat
+++ b/blackberry10/bin/templates/project/cordova/install-device.bat
@@ -17,7 +17,7 @@ goto comment
        specific language governing permissions and limitations
        under the License.
 :comment
-call "%~dps0init"
+call "%~dp0init"
 if ERRORLEVEL 1 exit /B 1
 
-"%CORDOVA_NODE%\node.exe" "%~dps0\lib\install-device" %*
+"%CORDOVA_NODE%\node.exe" "%~dp0\lib\install-device" %*

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/templates/project/cordova/install-emulator.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/install-emulator.bat b/blackberry10/bin/templates/project/cordova/install-emulator.bat
index bf1b3a5..2521da6 100644
--- a/blackberry10/bin/templates/project/cordova/install-emulator.bat
+++ b/blackberry10/bin/templates/project/cordova/install-emulator.bat
@@ -17,7 +17,7 @@ goto comment
        specific language governing permissions and limitations
        under the License.
 :comment
-call "%~dps0init"
+call "%~dp0init"
 if ERRORLEVEL 1 exit /B 1
 
-"%CORDOVA_NODE%\node.exe" "%~dps0\lib\install-emulator" %*
+"%CORDOVA_NODE%\node.exe" "%~dp0\lib\install-emulator" %*

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/templates/project/cordova/lib/list-devices.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/list-devices.bat b/blackberry10/bin/templates/project/cordova/lib/list-devices.bat
index 6bba9a0..db0602e 100644
--- a/blackberry10/bin/templates/project/cordova/lib/list-devices.bat
+++ b/blackberry10/bin/templates/project/cordova/lib/list-devices.bat
@@ -19,4 +19,4 @@
 call "%~dp0..\init"
 if ERRORLEVEL 1 exit /B 1
 
-"%CORDOVA_NODE%\node.exe" "%~dps0\list-devices.js"
+"%CORDOVA_NODE%\node.exe" "%~dp0\list-devices.js"

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/templates/project/cordova/lib/list-emulator-images.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/list-emulator-images.bat b/blackberry10/bin/templates/project/cordova/lib/list-emulator-images.bat
index c13d521..613a2a4 100644
--- a/blackberry10/bin/templates/project/cordova/lib/list-emulator-images.bat
+++ b/blackberry10/bin/templates/project/cordova/lib/list-emulator-images.bat
@@ -19,4 +19,4 @@
 call "%~dp0..\init"
 if ERRORLEVEL 1 exit /B 1
 
-"%CORDOVA_NODE%\node.exe" "%~dps0\list-emulator-images.js"
+"%CORDOVA_NODE%\node.exe" "%~dp0\list-emulator-images.js"

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/templates/project/cordova/lib/list-started-emulators.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/list-started-emulators.bat b/blackberry10/bin/templates/project/cordova/lib/list-started-emulators.bat
index 81dca2c..0931f39 100644
--- a/blackberry10/bin/templates/project/cordova/lib/list-started-emulators.bat
+++ b/blackberry10/bin/templates/project/cordova/lib/list-started-emulators.bat
@@ -19,4 +19,4 @@
 call "%~dp0..\init"
 if ERRORLEVEL 1 exit /B 1
 
-"%CORDOVA_NODE%\node.exe" "%~dps0\list-started-emulators.js"
+"%CORDOVA_NODE%\node.exe" "%~dp0\list-started-emulators.js"

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/templates/project/cordova/run.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/run.bat b/blackberry10/bin/templates/project/cordova/run.bat
index 6daeee8..42c413a 100755
--- a/blackberry10/bin/templates/project/cordova/run.bat
+++ b/blackberry10/bin/templates/project/cordova/run.bat
@@ -17,7 +17,7 @@ goto comment
        specific language governing permissions and limitations
        under the License.
 :comment
-call "%~dps0init"
+call "%~dp0init"
 if ERRORLEVEL 1 exit /B 1
 
-"%CORDOVA_NODE%\node.exe" "%~dps0\lib\run" %*
+"%CORDOVA_NODE%\node.exe" "%~dp0\lib\run" %*

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/templates/project/cordova/version.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/version.bat b/blackberry10/bin/templates/project/cordova/version.bat
index 47a487e..22e3526 100755
--- a/blackberry10/bin/templates/project/cordova/version.bat
+++ b/blackberry10/bin/templates/project/cordova/version.bat
@@ -17,7 +17,7 @@ goto comment
        specific language governing permissions and limitations
        under the License.
 :comment
-call "%~dps0init"
+call "%~dp0init"
 if ERRORLEVEL 1 exit /B 1
 
-"%CORDOVA_NODE%\node.exe" "%~dps0\lib\version" %*
+"%CORDOVA_NODE%\node.exe" "%~dp0\lib\version" %*

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/update.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/update.bat b/blackberry10/bin/update.bat
index 02bd6c7..5a71671 100755
--- a/blackberry10/bin/update.bat
+++ b/blackberry10/bin/update.bat
@@ -17,5 +17,5 @@ goto comment
        specific language governing permissions and limitations
        under the License.
 :comment
-call "%~dps0init"
-"%CORDOVA_NODE%\node.exe" "%~dps0\lib\update.js" %*
+call "%~dp0init"
+"%CORDOVA_NODE%\node.exe" "%~dp0\lib\update.js" %*

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/04491384/blackberry10/bin/whereis.cmd
----------------------------------------------------------------------
diff --git a/blackberry10/bin/whereis.cmd b/blackberry10/bin/whereis.cmd
new file mode 100644
index 0000000..372bcef
--- /dev/null
+++ b/blackberry10/bin/whereis.cmd
@@ -0,0 +1,19 @@
+@echo off
+setlocal enabledelayedexpansion
+set var_a=%1
+call :sub %var_a%
+if exist %var_b% if not exist %var_b%\nul goto exit
+for %%i in (.com .exe .cmd .bat) do (
+  call :sub %var_a%%%i
+  if exist !var_b! goto exit
+)
+echo INFO: could not find files for the given pattern(s) 1>&2
+exit /b 1
+
+:sub
+set var_b=%~$PATH:1
+goto :EOF
+
+:exit
+echo %var_b%
+exit /b 0