@echo off
setlocal enableextensions
set "SRC=%~dp0APP_FILES"
set "DEST=%LOCALAPPDATA%\ELLOS_CONTROL_MAPPING_PRO"

echo ================================================
echo ELLOS CONTROL MAPPING PRO - Install

echo ================================================
if not exist "%SRC%\ELLOS_3D_Mapping_Control_Offline.exe" (
  echo [ERROR] Den vrike to EXE sto APP_FILES.
  pause
  exit /b 1
)

if not exist "%DEST%" mkdir "%DEST%"
robocopy "%SRC%" "%DEST%" /E /R:1 /W:1 /NFL /NDL /NJH /NJS /NP >nul
if errorlevel 8 (
  echo [ERROR] Apotychia antiγραφis arxeion.
  pause
  exit /b 1
)

powershell -ExecutionPolicy Bypass -File "%~dp0scripts\create_shortcuts.ps1" -InstallDir "%DEST%"
if errorlevel 1 (
  echo [WARNING] Egine install, alla den dimiourgithikan shortcuts.
) else (
  echo Egine install kai shortcuts.
)

echo.
echo Anoigma app...
start "" "%DEST%\ELLOS_3D_Mapping_Control_Offline.exe"
echo.
echo To app egkatastathike sto:
echo %DEST%
pause
