131c75014Sopenharmony_ci:: Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
231c75014Sopenharmony_ci:: Licensed under the Apache License, Version 2.0 (the "License");
331c75014Sopenharmony_ci:: you may not use this file except in compliance with the License.
431c75014Sopenharmony_ci:: You may obtain a copy of the License at
531c75014Sopenharmony_ci::
631c75014Sopenharmony_ci::  http://www.apache.org/licenses/LICENSE-2.0
731c75014Sopenharmony_ci::
831c75014Sopenharmony_ci:: Unless required by applicable law or agreed to in writing, software
931c75014Sopenharmony_ci:: distributed under the License is distributed on an "AS IS" BASIS,
1031c75014Sopenharmony_ci:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1131c75014Sopenharmony_ci:: See the License for the specific language governing permissions and
1231c75014Sopenharmony_ci:: limitations under the License.
1331c75014Sopenharmony_ci
1431c75014Sopenharmony_ci@echo off
1531c75014Sopenharmony_ci@if "%DEBUG%" == "" @echo off
1631c75014Sopenharmony_ci@rem ##########################################################################
1731c75014Sopenharmony_ci@rem
1831c75014Sopenharmony_ci@rem  Hvigor startup script for Windows
1931c75014Sopenharmony_ci@rem
2031c75014Sopenharmony_ci@rem ##########################################################################
2131c75014Sopenharmony_ci
2231c75014Sopenharmony_ci@rem Set local scope for the variables with windows NT shell
2331c75014Sopenharmony_ciif "%OS%"=="Windows_NT" setlocal
2431c75014Sopenharmony_ci
2531c75014Sopenharmony_ciset DIRNAME=%~dp0
2631c75014Sopenharmony_ciif "%DIRNAME%" == "" set DIRNAME=.
2731c75014Sopenharmony_ciset APP_BASE_NAME=%~n0
2831c75014Sopenharmony_ciset APP_HOME=%DIRNAME%
2931c75014Sopenharmony_ci
3031c75014Sopenharmony_ci@rem Resolve any "." and ".." in APP_HOME to make it shorter.
3131c75014Sopenharmony_cifor %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
3231c75014Sopenharmony_ci
3331c75014Sopenharmony_ciset WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
3431c75014Sopenharmony_ciset NODE_EXE=node.exe
3531c75014Sopenharmony_ci
3631c75014Sopenharmony_cigoto start
3731c75014Sopenharmony_ci
3831c75014Sopenharmony_ci:start
3931c75014Sopenharmony_ci@rem Find node.exe
4031c75014Sopenharmony_ciif defined NODE_HOME goto findNodeFromNodeHome
4131c75014Sopenharmony_ci
4231c75014Sopenharmony_ci%NODE_EXE% --version >NUL 2>&1
4331c75014Sopenharmony_ciif "%ERRORLEVEL%" == "0" goto execute
4431c75014Sopenharmony_ci
4531c75014Sopenharmony_ciecho.
4631c75014Sopenharmony_ciecho ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
4731c75014Sopenharmony_ciecho.
4831c75014Sopenharmony_ciecho Please set the NODE_HOME variable in your environment to match the
4931c75014Sopenharmony_ciecho location of your NodeJs installation.
5031c75014Sopenharmony_ci
5131c75014Sopenharmony_cigoto fail
5231c75014Sopenharmony_ci
5331c75014Sopenharmony_ci:findNodeFromNodeHome
5431c75014Sopenharmony_ciset NODE_HOME=%NODE_HOME:"=%
5531c75014Sopenharmony_ciset NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
5631c75014Sopenharmony_ci
5731c75014Sopenharmony_ciif exist "%NODE_EXE_PATH%" goto execute
5831c75014Sopenharmony_ciecho.
5931c75014Sopenharmony_ciecho ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
6031c75014Sopenharmony_ciecho.
6131c75014Sopenharmony_ciecho Please set the NODE_HOME variable in your environment to match the
6231c75014Sopenharmony_ciecho location of your NodeJs installation.
6331c75014Sopenharmony_ci
6431c75014Sopenharmony_cigoto fail
6531c75014Sopenharmony_ci
6631c75014Sopenharmony_ci:execute
6731c75014Sopenharmony_ci@rem Execute hvigor
6831c75014Sopenharmony_ci"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
6931c75014Sopenharmony_ci
7031c75014Sopenharmony_ciif "%ERRORLEVEL%" == "0" goto hvigorwEnd
7131c75014Sopenharmony_ci
7231c75014Sopenharmony_ci:fail
7331c75014Sopenharmony_ciexit /b 1
7431c75014Sopenharmony_ci
7531c75014Sopenharmony_ci:hvigorwEnd
7631c75014Sopenharmony_ciif "%OS%" == "Windows_NT" endlocal
7731c75014Sopenharmony_ci
7831c75014Sopenharmony_ci:end
79