cyberofficial / Synthalingua

Synthalingua - Real Time Translation
http://synthalingua.site/
GNU General Public License v3.0
188 stars 16 forks source link

Reinstallation fix for setup.bat #59

Closed Adenser closed 9 months ago

Adenser commented 9 months ago

Fix issue where if statement would be ignorred and reinstallation would not happen.

I don't know if reinstalling in setup.bash works as intended, I don't have an environment to test it.

cyberofficial commented 9 months ago

Upon further investigation, if /i and if /I are both correct.

I did not account for one thing of handling both lower and upper characters in a newly spawned command prompt. Command prompts from spawn (launching .bat from explorer) is set in restricted mode compared to a terminal session already in place.

@echo off
setlocal enabledelayedexpansion
Title Realtime Whipser Translation App
cls

if exist "data_whisper" (
    set /p reinstall="Python environment already exists. Do you want to reinstall? [y/n]: "
    if /i "!reinstall!"=="y" (
        echo Deleting existing environment...
        REM call data_whisper\Scripts\deactivate.bat :: Not Needed for now
        rmdir /s /q data_whisper
    ) else (
        echo Exiting...
        pause
        exit /b
    )
)

I have changed some minor things

Thank you for bringing this to my attention..

If you want to take the code I provided and put into your change, I can merge your change, or if you want to close it up to you.

Adenser commented 9 months ago

I have updated the commit with your change. I hope I did it the right way because I have never updated commits before 😅

As always, thank you very much for your work!

cyberofficial commented 9 months ago

Merged! Thank you again!