13e0f1854Sopenharmony_ci/**
23e0f1854Sopenharmony_ci * Copyright (c) 2024-2024 Huawei Device Co., Ltd.
33e0f1854Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
43e0f1854Sopenharmony_ci * you may not use this file except in compliance with the License.
53e0f1854Sopenharmony_ci * You may obtain a copy of the License at
63e0f1854Sopenharmony_ci *
73e0f1854Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
83e0f1854Sopenharmony_ci *
93e0f1854Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
103e0f1854Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
113e0f1854Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
123e0f1854Sopenharmony_ci * See the License for the specific language governing permissions and
133e0f1854Sopenharmony_ci * limitations under the License.
143e0f1854Sopenharmony_ci */
153e0f1854Sopenharmony_ci
163e0f1854Sopenharmony_ci@if "%DEBUG%" == "" @echo off
173e0f1854Sopenharmony_ci@rem ##########################################################################
183e0f1854Sopenharmony_ci@rem
193e0f1854Sopenharmony_ci@rem  Hvigor startup script for Windows
203e0f1854Sopenharmony_ci@rem
213e0f1854Sopenharmony_ci@rem ##########################################################################
223e0f1854Sopenharmony_ci
233e0f1854Sopenharmony_ci@rem Set local scope for the variables with windows NT shell
243e0f1854Sopenharmony_ciif "%OS%"=="Windows_NT" setlocal
253e0f1854Sopenharmony_ci
263e0f1854Sopenharmony_ciset DIRNAME=%~dp0
273e0f1854Sopenharmony_ciif "%DIRNAME%" == "" set DIRNAME=.
283e0f1854Sopenharmony_ciset APP_BASE_NAME=%~n0
293e0f1854Sopenharmony_ciset APP_HOME=%DIRNAME%
303e0f1854Sopenharmony_ci
313e0f1854Sopenharmony_ci@rem Resolve any "." and ".." in APP_HOME to make it shorter.
323e0f1854Sopenharmony_cifor %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
333e0f1854Sopenharmony_ci
343e0f1854Sopenharmony_ciset WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
353e0f1854Sopenharmony_ciset NODE_EXE=node.exe
363e0f1854Sopenharmony_ci
373e0f1854Sopenharmony_cigoto start
383e0f1854Sopenharmony_ci
393e0f1854Sopenharmony_ci:start
403e0f1854Sopenharmony_ci@rem Find node.exe
413e0f1854Sopenharmony_ciif defined NODE_HOME goto findNodeFromNodeHome
423e0f1854Sopenharmony_ci
433e0f1854Sopenharmony_ci%NODE_EXE% --version >NUL 2>&1
443e0f1854Sopenharmony_ciif "%ERRORLEVEL%" == "0" goto execute
453e0f1854Sopenharmony_ci
463e0f1854Sopenharmony_ciecho.
473e0f1854Sopenharmony_ciecho ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
483e0f1854Sopenharmony_ciecho.
493e0f1854Sopenharmony_ciecho Please set the NODE_HOME variable in your environment to match the
503e0f1854Sopenharmony_ciecho location of your NodeJs installation.
513e0f1854Sopenharmony_ci
523e0f1854Sopenharmony_cigoto fail
533e0f1854Sopenharmony_ci
543e0f1854Sopenharmony_ci:findNodeFromNodeHome
553e0f1854Sopenharmony_ciset NODE_HOME=%NODE_HOME:"=%
563e0f1854Sopenharmony_ciset NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
573e0f1854Sopenharmony_ci
583e0f1854Sopenharmony_ciif exist "%NODE_EXE_PATH%" goto execute
593e0f1854Sopenharmony_ciecho.
603e0f1854Sopenharmony_ciecho ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
613e0f1854Sopenharmony_ciecho.
623e0f1854Sopenharmony_ciecho Please set the NODE_HOME variable in your environment to match the
633e0f1854Sopenharmony_ciecho location of your NodeJs installation.
643e0f1854Sopenharmony_ci
653e0f1854Sopenharmony_cigoto fail
663e0f1854Sopenharmony_ci
673e0f1854Sopenharmony_ci:execute
683e0f1854Sopenharmony_ci@rem Execute hvigor
693e0f1854Sopenharmony_ci"%NODE_EXE%" "%WRAPPER_MODULE_PATH%" %*
703e0f1854Sopenharmony_ci
713e0f1854Sopenharmony_ciif "%ERRORLEVEL%" == "0" goto hvigorwEnd
723e0f1854Sopenharmony_ci
733e0f1854Sopenharmony_ci:fail
743e0f1854Sopenharmony_ciexit /b 1
753e0f1854Sopenharmony_ci
763e0f1854Sopenharmony_ci:hvigorwEnd
773e0f1854Sopenharmony_ciif "%OS%" == "Windows_NT" endlocal
783e0f1854Sopenharmony_ci
793e0f1854Sopenharmony_ci:end
80