119e95205Sopenharmony_ci/*
219e95205Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd.
319e95205Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
419e95205Sopenharmony_ci * you may not use this file except in compliance with the License.
519e95205Sopenharmony_ci * You may obtain a copy of the License at
619e95205Sopenharmony_ci *
719e95205Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
819e95205Sopenharmony_ci *
919e95205Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1019e95205Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1119e95205Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1219e95205Sopenharmony_ci * See the License for the specific language governing permissions and
1319e95205Sopenharmony_ci * limitations under the License.
1419e95205Sopenharmony_ci */
1519e95205Sopenharmony_ci@if "%DEBUG%" == "" @echo off
1619e95205Sopenharmony_ci@rem ##########################################################################
1719e95205Sopenharmony_ci@rem
1819e95205Sopenharmony_ci@rem  Hvigor startup script for Windows
1919e95205Sopenharmony_ci@rem
2019e95205Sopenharmony_ci@rem ##########################################################################
2119e95205Sopenharmony_ci
2219e95205Sopenharmony_ci@rem Set local scope for the variables with windows NT shell
2319e95205Sopenharmony_ciif "%OS%"=="Windows_NT" setlocal
2419e95205Sopenharmony_ci
2519e95205Sopenharmony_ciset DIRNAME=%~dp0
2619e95205Sopenharmony_ciif "%DIRNAME%" == "" set DIRNAME=.
2719e95205Sopenharmony_ciset APP_BASE_NAME=%~n0
2819e95205Sopenharmony_ciset APP_HOME=%DIRNAME%
2919e95205Sopenharmony_ci
3019e95205Sopenharmony_ci@rem Resolve any "." and ".." in APP_HOME to make it shorter.
3119e95205Sopenharmony_cifor %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
3219e95205Sopenharmony_ci
3319e95205Sopenharmony_ciset WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
3419e95205Sopenharmony_ciset NODE_EXE=node.exe
3519e95205Sopenharmony_ci
3619e95205Sopenharmony_cigoto start
3719e95205Sopenharmony_ci
3819e95205Sopenharmony_ci:start
3919e95205Sopenharmony_ci@rem Find node.exe
4019e95205Sopenharmony_ciif defined NODE_HOME goto findNodeFromNodeHome
4119e95205Sopenharmony_ci
4219e95205Sopenharmony_ci%NODE_EXE% --version >NUL 2>&1
4319e95205Sopenharmony_ciif "%ERRORLEVEL%" == "0" goto execute
4419e95205Sopenharmony_ci
4519e95205Sopenharmony_ciecho.
4619e95205Sopenharmony_ciecho ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
4719e95205Sopenharmony_ciecho.
4819e95205Sopenharmony_ciecho Please set the NODE_HOME variable in your environment to match the
4919e95205Sopenharmony_ciecho location of your NodeJs installation.
5019e95205Sopenharmony_ci
5119e95205Sopenharmony_cigoto fail
5219e95205Sopenharmony_ci
5319e95205Sopenharmony_ci:findNodeFromNodeHome
5419e95205Sopenharmony_ciset NODE_HOME=%NODE_HOME:"=%
5519e95205Sopenharmony_ciset NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
5619e95205Sopenharmony_ci
5719e95205Sopenharmony_ciif exist "%NODE_EXE_PATH%" goto execute
5819e95205Sopenharmony_ciecho.
5919e95205Sopenharmony_ciecho ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
6019e95205Sopenharmony_ciecho.
6119e95205Sopenharmony_ciecho Please set the NODE_HOME variable in your environment to match the
6219e95205Sopenharmony_ciecho location of your NodeJs installation.
6319e95205Sopenharmony_ci
6419e95205Sopenharmony_cigoto fail
6519e95205Sopenharmony_ci
6619e95205Sopenharmony_ci:execute
6719e95205Sopenharmony_ci@rem Execute hvigor
6819e95205Sopenharmony_ci"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
6919e95205Sopenharmony_ci
7019e95205Sopenharmony_ciif "%ERRORLEVEL%" == "0" goto hvigorwEnd
7119e95205Sopenharmony_ci
7219e95205Sopenharmony_ci:fail
7319e95205Sopenharmony_ciexit /b 1
7419e95205Sopenharmony_ci
7519e95205Sopenharmony_ci:hvigorwEnd
7619e95205Sopenharmony_ciif "%OS%" == "Windows_NT" endlocal
7719e95205Sopenharmony_ci
7819e95205Sopenharmony_ci:end
79