10704ebd2Sopenharmony_ci@rem Copyright (C) 2024 Huawei Device Co., Ltd.
20704ebd2Sopenharmony_ci@rem Licensed under the Apache License, Version 2.0 (the "License");
30704ebd2Sopenharmony_ci@rem you may not use this file except in compliance with the License.
40704ebd2Sopenharmony_ci@rem You may obtain a copy of the License at
50704ebd2Sopenharmony_ci@rem
60704ebd2Sopenharmony_ci@rem     http://www.apache.org/licenses/LICENSE-2.0
70704ebd2Sopenharmony_ci@rem
80704ebd2Sopenharmony_ci@rem Unless required by applicable law or agreed to in writing, software
90704ebd2Sopenharmony_ci@rem distributed under the License is distributed on an "AS IS" BASIS,
100704ebd2Sopenharmony_ci@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
110704ebd2Sopenharmony_ci@rem See the License for the specific language governing permissions and
120704ebd2Sopenharmony_ci@rem limitations under the License.
130704ebd2Sopenharmony_ci@echo off
140704ebd2Sopenharmony_ci@if NOT "%DEBUG%" == "" @echo on
150704ebd2Sopenharmony_ci@rem ##########################################################################
160704ebd2Sopenharmony_ci@rem
170704ebd2Sopenharmony_ci@rem  Hvigor startup script for Windows
180704ebd2Sopenharmony_ci@rem
190704ebd2Sopenharmony_ci@rem ##########################################################################
200704ebd2Sopenharmony_ci
210704ebd2Sopenharmony_ci@rem Set local scope for the variables with windows NT shell
220704ebd2Sopenharmony_ciif "%OS%"=="Windows_NT" setlocal
230704ebd2Sopenharmony_ci
240704ebd2Sopenharmony_ciset DIRNAME=%~dp0
250704ebd2Sopenharmony_ciif "%DIRNAME%" == "" set DIRNAME=.
260704ebd2Sopenharmony_ciset APP_BASE_NAME=%~n0
270704ebd2Sopenharmony_ciset APP_HOME=%DIRNAME%
280704ebd2Sopenharmony_ci
290704ebd2Sopenharmony_ci@rem Resolve any "." and ".." in APP_HOME to make it shorter.
300704ebd2Sopenharmony_cifor %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
310704ebd2Sopenharmony_ci
320704ebd2Sopenharmony_ciset WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
330704ebd2Sopenharmony_ciset NODE_EXE=node.exe
340704ebd2Sopenharmony_ci
350704ebd2Sopenharmony_cigoto start
360704ebd2Sopenharmony_ci
370704ebd2Sopenharmony_ci:start
380704ebd2Sopenharmony_ci@rem Find node.exe
390704ebd2Sopenharmony_ciif defined NODE_HOME goto findNodeFromNodeHome
400704ebd2Sopenharmony_ci
410704ebd2Sopenharmony_ci%NODE_EXE% --version >NUL 2>&1
420704ebd2Sopenharmony_ciif "%ERRORLEVEL%" == "0" goto execute
430704ebd2Sopenharmony_ci
440704ebd2Sopenharmony_ciecho.
450704ebd2Sopenharmony_ciecho ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
460704ebd2Sopenharmony_ciecho.
470704ebd2Sopenharmony_ciecho Please set the NODE_HOME variable in your environment to match the
480704ebd2Sopenharmony_ciecho location of your NodeJs installation.
490704ebd2Sopenharmony_ci
500704ebd2Sopenharmony_cigoto fail
510704ebd2Sopenharmony_ci
520704ebd2Sopenharmony_ci:findNodeFromNodeHome
530704ebd2Sopenharmony_ciset NODE_HOME=%NODE_HOME:"=%
540704ebd2Sopenharmony_ciset NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
550704ebd2Sopenharmony_ci
560704ebd2Sopenharmony_ciif exist "%NODE_EXE_PATH%" goto execute
570704ebd2Sopenharmony_ciecho.
580704ebd2Sopenharmony_ciecho ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
590704ebd2Sopenharmony_ciecho.
600704ebd2Sopenharmony_ciecho Please set the NODE_HOME variable in your environment to match the
610704ebd2Sopenharmony_ciecho location of your NodeJs installation.
620704ebd2Sopenharmony_ci
630704ebd2Sopenharmony_cigoto fail
640704ebd2Sopenharmony_ci
650704ebd2Sopenharmony_ci:execute
660704ebd2Sopenharmony_ci@rem Execute hvigor
670704ebd2Sopenharmony_ci"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
680704ebd2Sopenharmony_ci
690704ebd2Sopenharmony_ciif "%ERRORLEVEL%" == "0" goto hvigorwEnd
700704ebd2Sopenharmony_ci
710704ebd2Sopenharmony_ci:fail
720704ebd2Sopenharmony_ciexit /b 1
730704ebd2Sopenharmony_ci
740704ebd2Sopenharmony_ci:hvigorwEnd
750704ebd2Sopenharmony_ciif "%OS%" == "Windows_NT" endlocal
760704ebd2Sopenharmony_ci
770704ebd2Sopenharmony_ci:end
78