Skip to content

Instantly share code, notes, and snippets.

@faelBrunnoS
Created April 1, 2022 18:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save faelBrunnoS/058ff937135fc7eed854588a0831ccb7 to your computer and use it in GitHub Desktop.
This is an installer for Thunderstore hosted Valheim mod localizations.
@ECHO off
ECHO =====================================================================
ECHO:
ECHO Script created by Luduaver (faelBrunnoS) for Thunderstore Valheim Mod Manager
ECHO:
ECHO =====================================================================
TIMEOUT /t 5 >NUL
ECHO:
ECHO:
ECHO:
:: ===================== IMPORTANT ======================
:: This is the only line of code that needs to be changed
:: Set the destination folder name after the "="
SET "folderName=Auga"
:: Do not change the "folderName" text, otherwise the code will not work.
:: ===================== IMPORTANT ======================
:LOCALIZATION
::TEXTS
SET "invalidFolder=Invalid option, select again."
SET "folderExists1=The %folderName% folder already exists."
SET "folderExists2=To create a link to the folder, you must remove it."
SET "cancel=Installation aborted by user."
SET "removed=The folder has been removed."
SET "successful=The mod has been successfully installed."
::CHOICE
SET "Y1=Y"
SET "y2=y"
SET "YES1=YES"
SET "yes2=yes"
SET "N1=N"
SET "n2=n"
SET "NO1=NO"
SET "no2=no"
SET "continue=Do you want to remove the %folderName% folder? [%YES1%/%NO1%]"
:SCRIPT
:: Get the mod's Thunderstore ID
for %%I in (.) do SET modFolderID=%%~nxI
:: Get the previous folder path
SET ROOT=%CD%
CD %ROOT%\..
SET PREVIOUS=%CD%
CD %ROOT%
:: Check if the destination folder exists
IF EXIST "%PREVIOUS%\%folderName%" GOTO DELETEPROMPT
IF NOT EXIST "%PREVIOUS%\%folderName%" GOTO CREATEMKLINK
:INVALIDOPTION
CLS
ECHO %invalidFolder%
TIMEOUT /t 5 >NUL
:: Asks if you want to remove the existing destination folder
:DELETEPROMPT
CLS
ECHO %folderExists1%
ECHO %folderExists2%
ECHO:
ECHO %continue%
SET /p "deleteConfirm="
IF %deleteConfirm% == %Y1% GOTO DELETEFOLDER
IF %deleteConfirm% == %y2% GOTO DELETEFOLDER
IF %deleteConfirm% == %YES1% GOTO DELETEFOLDER
IF %deleteConfirm% == %yes2% GOTO DELETEFOLDER
IF %deleteConfirm% == %N1% GOTO EXIT
IF %deleteConfirm% == %n2% GOTO EXIT
IF %deleteConfirm% == %NO1% GOTO EXIT
IF %deleteConfirm% == %no2% GOTO EXIT
GOTO INVALIDOPTION
:EXIT
ECHO %cancel%
TIMEOUT /t 5 >NUL
EXIT
:: Remove existing destination folder
:DELETEFOLDER
CLS
@RD /S /Q "%PREVIOUS%\%folderName%"
ECHO %removed%
TIMEOUT /t 5 >NUL
:: Create an mklink to the mod folder
:CREATEMKLINK
mklink /J "%PREVIOUS%\%folderName%" "%PREVIOUS%\%modFolderID%" >NUL
CLS
ECHO %successful%
TIMEOUT /t 5 >NUL
EXIT
@faelBrunnoS
Copy link
Author

faelBrunnoS commented Apr 1, 2022

To use it in your translation, just put it together with your translation files and change line 15.
In the case of the file, it is already using the Auga folder to translate the Project Auga mod.

If you want to translate the batch to your language, just edit the :LOCALIZATION section to your language.
Following the same rule as folderName

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment