199da06d0Sopenharmony_ci# Copyright (c) 2022 Huawei Device Co., Ltd.
299da06d0Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
399da06d0Sopenharmony_ci# you may not use this file except in compliance with the License.
499da06d0Sopenharmony_ci# You may obtain a copy of the License at
599da06d0Sopenharmony_ci#
699da06d0Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
799da06d0Sopenharmony_ci#
899da06d0Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
999da06d0Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1099da06d0Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1199da06d0Sopenharmony_ci# See the License for the specific language governing permissions and
1299da06d0Sopenharmony_ci# limitations under the License.
1399da06d0Sopenharmony_ci@if "%DEBUG%" == "" @echo off
1499da06d0Sopenharmony_ci@rem ##########################################################################
1599da06d0Sopenharmony_ci@rem
1699da06d0Sopenharmony_ci@rem  Hvigor startup script for Windows
1799da06d0Sopenharmony_ci@rem
1899da06d0Sopenharmony_ci@rem ##########################################################################
1999da06d0Sopenharmony_ci
2099da06d0Sopenharmony_ci@rem Set local scope for the variables with windows NT shell
2199da06d0Sopenharmony_ciif "%OS%"=="Windows_NT" setlocal
2299da06d0Sopenharmony_ci
2399da06d0Sopenharmony_ciset DIRNAME=%~dp0
2499da06d0Sopenharmony_ciif "%DIRNAME%" == "" set DIRNAME=.
2599da06d0Sopenharmony_ciset APP_BASE_NAME=%~n0
2699da06d0Sopenharmony_ciset APP_HOME=%DIRNAME%
2799da06d0Sopenharmony_ci
2899da06d0Sopenharmony_ci@rem Resolve any "." and ".." in APP_HOME to make it shorter.
2999da06d0Sopenharmony_cifor %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
3099da06d0Sopenharmony_ci
3199da06d0Sopenharmony_ciset WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
3299da06d0Sopenharmony_ciset NODE_EXE=node.exe
3399da06d0Sopenharmony_ci
3499da06d0Sopenharmony_cigoto start
3599da06d0Sopenharmony_ci
3699da06d0Sopenharmony_ci:start
3799da06d0Sopenharmony_ci@rem Find node.exe
3899da06d0Sopenharmony_ciif defined NODE_HOME goto findNodeFromNodeHome
3999da06d0Sopenharmony_ci
4099da06d0Sopenharmony_ci%NODE_EXE% --version >NUL 2>&1
4199da06d0Sopenharmony_ciif "%ERRORLEVEL%" == "0" goto execute
4299da06d0Sopenharmony_ci
4399da06d0Sopenharmony_ciecho.
4499da06d0Sopenharmony_ciecho ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
4599da06d0Sopenharmony_ciecho.
4699da06d0Sopenharmony_ciecho Please set the NODE_HOME variable in your environment to match the
4799da06d0Sopenharmony_ciecho location of your NodeJs installation.
4899da06d0Sopenharmony_ci
4999da06d0Sopenharmony_cigoto fail
5099da06d0Sopenharmony_ci
5199da06d0Sopenharmony_ci:findNodeFromNodeHome
5299da06d0Sopenharmony_ciset NODE_HOME=%NODE_HOME:"=%
5399da06d0Sopenharmony_ciset NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
5499da06d0Sopenharmony_ci
5599da06d0Sopenharmony_ciif exist "%NODE_EXE_PATH%" goto execute
5699da06d0Sopenharmony_ciecho.
5799da06d0Sopenharmony_ciecho ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
5899da06d0Sopenharmony_ciecho.
5999da06d0Sopenharmony_ciecho Please set the NODE_HOME variable in your environment to match the
6099da06d0Sopenharmony_ciecho location of your NodeJs installation.
6199da06d0Sopenharmony_ci
6299da06d0Sopenharmony_cigoto fail
6399da06d0Sopenharmony_ci
6499da06d0Sopenharmony_ci:execute
6599da06d0Sopenharmony_ci@rem Execute hvigor
6699da06d0Sopenharmony_ci"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
6799da06d0Sopenharmony_ci
6899da06d0Sopenharmony_ci:fail
6999da06d0Sopenharmony_ciexit /b 1
70