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