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