1f6603c60Sopenharmony_ci@rem Copyright (C) 2024 Huawei Device Co., Ltd.
2f6603c60Sopenharmony_ci@rem Licensed under the Apache License, Version 2.0 (the "License");
3f6603c60Sopenharmony_ci@rem you may not use this file except in compliance with the License.
4f6603c60Sopenharmony_ci@rem You may obtain a copy of the License at
5f6603c60Sopenharmony_ci@rem
6f6603c60Sopenharmony_ci@rem     http://www.apache.org/licenses/LICENSE-2.0
7f6603c60Sopenharmony_ci@rem
8f6603c60Sopenharmony_ci@rem Unless required by applicable law or agreed to in writing, software
9f6603c60Sopenharmony_ci@rem distributed under the License is distributed on an "AS IS" BASIS,
10f6603c60Sopenharmony_ci@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11f6603c60Sopenharmony_ci@rem See the License for the specific language governing permissions and
12f6603c60Sopenharmony_ci@rem limitations under the License.
13f6603c60Sopenharmony_ci@echo off
14f6603c60Sopenharmony_ci@rem
15f6603c60Sopenharmony_ci@rem  -------------------------------------------------------------------
16f6603c60Sopenharmony_ci@rem  Hvigor startup script for Windows, version 1.0.0
17f6603c60Sopenharmony_ci@rem
18f6603c60Sopenharmony_ci@rem  Required ENV vars:
19f6603c60Sopenharmony_ci@rem  ------------------
20f6603c60Sopenharmony_ci@rem    NODE_HOME - location of a Node home dir
21f6603c60Sopenharmony_ci@rem    or
22f6603c60Sopenharmony_ci@rem    Add %NODE_HOME%/bin to the PATH environment variable
23f6603c60Sopenharmony_ci@rem  -------------------------------------------------------------------
24f6603c60Sopenharmony_ci@rem
25f6603c60Sopenharmony_ci
26f6603c60Sopenharmony_ciset DIRNAME=%~dp0
27f6603c60Sopenharmony_ciset APP_BASE_NAME=%~n0
28f6603c60Sopenharmony_ciset NODE_EXE_PATH=""
29f6603c60Sopenharmony_ciset APP_HOME=.
30f6603c60Sopenharmony_ciset WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
31f6603c60Sopenharmony_ciset NODE_EXE=node.exe
32f6603c60Sopenharmony_ci@rem set NODE_OPTS="--max-old-space-size=4096"
33f6603c60Sopenharmony_ci
34f6603c60Sopenharmony_ci@rem Resolve any "." and ".." in APP_HOME to make it shorter.
35f6603c60Sopenharmony_cifor %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
36f6603c60Sopenharmony_ci
37f6603c60Sopenharmony_ciif not defined NODE_OPTS set NODE_OPTS="--"
38f6603c60Sopenharmony_ci
39f6603c60Sopenharmony_ci@rem Find node.exe
40f6603c60Sopenharmony_ciif defined NODE_HOME (
41f6603c60Sopenharmony_ci    set NODE_HOME=%NODE_HOME:"=%
42f6603c60Sopenharmony_ci    set "PATH=%PATH%;%NODE_HOME%"
43f6603c60Sopenharmony_ci    set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
44f6603c60Sopenharmony_ci)
45f6603c60Sopenharmony_ci
46f6603c60Sopenharmony_ci%NODE_EXE% --version >NUL 2>&1
47f6603c60Sopenharmony_ciif "%ERRORLEVEL%" == "0" (
48f6603c60Sopenharmony_ci    "%NODE_EXE%" "%NODE_OPTS%" "%WRAPPER_MODULE_PATH%" %*
49f6603c60Sopenharmony_ci) else if exist "%NODE_EXE_PATH%" (
50f6603c60Sopenharmony_ci    "%NODE_EXE_PATH%" "%NODE_OPTS%" "%WRAPPER_MODULE_PATH%" %*
51f6603c60Sopenharmony_ci) else (
52f6603c60Sopenharmony_ci    echo.
53f6603c60Sopenharmony_ci    echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
54f6603c60Sopenharmony_ci    echo.
55f6603c60Sopenharmony_ci    echo Please set the NODE_HOME variable in your environment to match the
56f6603c60Sopenharmony_ci    echo location of your NodeJs installation.
57f6603c60Sopenharmony_ci)
58f6603c60Sopenharmony_ci
59f6603c60Sopenharmony_ciif "%ERRORLEVEL%" == "0"(
60f6603c60Sopenharmony_ci    if "%OS%" == "Windows_NT" endlocal
61f6603c60Sopenharmony_ci) else (
62f6603c60Sopenharmony_ci    exit /b %ERRORLEVEL%
63f6603c60Sopenharmony_ci)
64