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@if "%DEBUG%" == "" @echo off
15@rem ##########################################################################
16@rem
17@rem  Hvigor startup script for Windows
18@rem
19@rem ##########################################################################
20
21@rem Set local scope for the variables with windows NT shell
22if "%OS%"=="Windows_NT" setlocal
23
24set DIRNAME=%~dp0
25if "%DIRNAME%" == "" set DIRNAME=.
26set APP_BASE_NAME=%~n0
27set APP_HOME=%DIRNAME%
28
29@rem Resolve any "." and ".." in APP_HOME to make it shorter.
30for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
31
32set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
33set NODE_EXE=node.exe
34
35goto start
36
37:start
38@rem Find node.exe
39if defined NODE_HOME goto findNodeFromNodeHome
40
41%NODE_EXE% --version >NUL 2>&1
42if "%ERRORLEVEL%" == "0" goto execute
43
44echo.
45echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
46echo.
47echo Please set the NODE_HOME variable in your environment to match the
48echo location of your NodeJs installation.
49
50goto fail
51
52:findNodeFromNodeHome
53set NODE_HOME=%NODE_HOME:"=%
54set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
55
56if exist "%NODE_EXE_PATH%" goto execute
57echo.
58echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
59echo.
60echo Please set the NODE_HOME variable in your environment to match the
61echo location of your NodeJs installation.
62
63goto fail
64
65:execute
66@rem Execute hvigor
67"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
68
69:fail
70exit /b 1
71