@echo off
setlocal ENABLEDELAYEDEXPANSION
title Honey Multi-FX Synth Installer
@honeycolor
CLS

echo ==========================================
echo   Honey Multi-FX Synth - FL Studio Install
echo ==========================================
echo.

REM ---- Defaults ----
set "DEFAULT_DEST=%USERPROFILE%\Documents\Image-Line\FL Studio\Data\Plugin Presets\Patcher\Honey Multi-FX Synth"
set "DEST=%DEFAULT_DEST%"

:choosePath
echo Default install folder:
echo   %DEST%
echo.
CHOICE /C YN /N /M "Do you want to change the install folder? (Y/N): "
REM CHOICE returns ERRORLEVEL 1 for Y, 2 for N
if errorlevel 2 goto confirmDest
if errorlevel 1 goto inputDest

:inputDest
echo.
set "USERPATH="
set /p USERPATH=Enter full path for install folder: 
if "%USERPATH%"=="" (
    echo No path entered. Using default folder.
) else (
    set "DEST=%USERPATH%"
)
echo.
goto confirmDest

:confirmDest
echo Install destination:
echo   %DEST%
echo.
CHOICE /C YN /N /M "Continue with this destination? (Y/N): "
if errorlevel 2 goto choosePath
if errorlevel 1 goto proceed

:proceed
echo.
if exist "%DEST%" (
    echo WARNING: The folder already exists.
    CHOICE /C YN /N /M "Overwrite its contents? (Y/N): "
    if errorlevel 2 (
        echo Install cancelled by user.
        goto done
    )
) else (
    echo Creating folder...
    mkdir "%DEST%" 2>nul
    if errorlevel 1 (
        echo.
        echo ERROR: Could not create folder:
        echo   %DEST%
        echo Check permissions or choose a different location.
        goto done
    )
)

echo.
echo Copying Honey.fst...
copy /Y "Honey.fst" "%DEST%\" >nul
if errorlevel 1 (
    echo ERROR: Failed to copy Honey.fst. Is the file next to this installer?
    goto done
)

echo Copying Assets folder...
mkdir "%DEST%\Assets" 2>nul
xcopy "Assets" "%DEST%\Assets\" /E /I /Y >nul
if errorlevel 1 (
    echo ERROR: Failed to copy Assets. Make sure the "Assets" folder is next to this installer.
    goto done
)

echo.
echo Install complete!
echo.
echo Next steps in FL Studio:
echo   1) Options -> File settings -> Browser extra search folders
echo   2) Add this path so FL Studio finds the assets:
echo      %DEST%\Assets
echo.
echo Then load:
echo   Patcher -> Presets -> Honey Multi-FX Synth -> Honey.fst

:done
echo.
pause
endlocal
