1/*
2 * Copyright (C) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15@if "%DEBUG%" == "" @echo off
16@rem ##########################################################################
17@rem
18@rem  Hvigor startup script for Windows
19@rem
20@rem ##########################################################################
21
22@rem Set local scope for the variables with windows NT shell
23if "%OS%"=="Windows_NT" setlocal
24
25set DIRNAME=%~dp0
26if "%DIRNAME%" == "" set DIRNAME=.
27set APP_BASE_NAME=%~n0
28set APP_HOME=%DIRNAME%
29
30@rem Resolve any "." and ".." in APP_HOME to make it shorter.
31for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
32
33set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
34set NODE_EXE=node.exe
35
36goto start
37
38:start
39@rem Find node.exe
40if defined NODE_HOME goto findNodeFromNodeHome
41
42%NODE_EXE% --version >NUL 2>&1
43if "%ERRORLEVEL%" == "0" goto execute
44
45echo.
46echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
47echo.
48echo Please set the NODE_HOME variable in your environment to match the
49echo location of your NodeJs installation.
50
51goto fail
52
53:findNodeFromNodeHome
54set NODE_HOME=%NODE_HOME:"=%
55set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
56
57if exist "%NODE_EXE_PATH%" goto execute
58echo.
59echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
60echo.
61echo Please set the NODE_HOME variable in your environment to match the
62echo location of your NodeJs installation.
63
64goto fail
65
66:execute
67@rem Execute hvigor
68"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
69
70if "%ERRORLEVEL%" == "0" goto hvigorwEnd
71
72:fail
73exit /b 1
74
75:hvigorwEnd
76if "%OS%" == "Windows_NT" endlocal
77
78:end
79