structured folder

This commit is contained in:
Draqoken
2025-04-08 02:53:19 +03:00
parent e6d65b30b9
commit 5e77d7e9cf
11 changed files with 93 additions and 3 deletions

88
installer.bat Normal file
View File

@@ -0,0 +1,88 @@
@echo off
setlocal
:: --------- Setup Log ---------
set "LOG_FILE=cosmic_setup.log"
echo [%DATE% %TIME%] Starting script... > "%LOG_FILE%"
:: --------- Admin Check ---------
net session >nul 2>&1
if %errorlevel% neq 0 (
echo You must run this script as Administrator!
echo [%DATE% %TIME%] ERROR: Script not run as administrator. >> "%LOG_FILE%"
pause
exit /b
)
echo [%DATE% %TIME%] Admin check passed. >> "%LOG_FILE%"
:: --------- Define Paths ---------
set "CURRENT_DIR=%~dp0"
if "%CURRENT_DIR:~-1%"=="\" set "CURRENT_DIR=%CURRENT_DIR:~0,-1%"
set "TARGET_DIR=%USERPROFILE%\Documents\VIP Mud\Cosmic Rage"
set "SET_FILE=%TARGET_DIR%\cosmic rage.set"
set "LOADER_FILE=%TARGET_DIR%\loader.set"
echo [%DATE% %TIME%] Script location: %CURRENT_DIR% >> "%LOG_FILE%"
echo [%DATE% %TIME%] Target directory: %TARGET_DIR% >> "%LOG_FILE%"
:: --------- Handle Existing Folder ---------
if exist "%TARGET_DIR%" (
echo The target folder already exists: "%TARGET_DIR%"
echo Would you like to delete and recreate it? (Y/N)
set "userchoice="
set /p userchoice=Your choice:
if /i "%userchoice%"=="Y" (
echo [%DATE% %TIME%] Deleting existing folder... >> "%LOG_FILE%"
rd /s /q "%TARGET_DIR%"
if exist "%TARGET_DIR%" (
echo [%DATE% %TIME%] ERROR: Could not delete folder. >> "%LOG_FILE%"
echo ERROR: Could not delete folder. Files might be in use.
pause
exit /b
)
echo Creating fresh folder...
mkdir "%TARGET_DIR%"
) else (
echo [%DATE% %TIME%] Keeping existing folder. >> "%LOG_FILE%"
echo Continuing with existing folder...
)
) else (
echo [%DATE% %TIME%] Folder does not exist. Creating new one. >> "%LOG_FILE%"
mkdir "%TARGET_DIR%"
)
if not exist "%TARGET_DIR%" (
echo [%DATE% %TIME%] ERROR: Failed to create folder. >> "%LOG_FILE%"
echo ERROR: Could not create folder. Check permissions or path.
pause
exit /b
)
echo [%DATE% %TIME%] Folder is ready. >> "%LOG_FILE%"
:: --------- Create cosmic rage.set ---------
if not exist "%SET_FILE%" (
echo [%DATE% %TIME%] Creating cosmic rage.set >> "%LOG_FILE%"
(
echo #Load ^{%%CharInfo^(MudName^)/loader.set^}
echo #If ^{%%Defined^(scpath^)=1 and %%Defined^(sppath^)=1^} ^{ #Load @scpath/Main.set^} ^{ #Say ^{WARNING! The scripts path and/or the sounds path are not defined. Unable to load the soundpack!^}^}
) > "%SET_FILE%"
echo Created: cosmic rage.set
) else (
echo cosmic rage.set already exists.
)
:: --------- Create loader.set ---------
if not exist "%LOADER_FILE%" (
echo [%DATE% %TIME%] Creating loader.set >> "%LOG_FILE%"
echo #Var scpath ^{%CURRENT_DIR%^/scripts} > "%LOADER_FILE%"
echo Created: loader.set
) else (
echo loader.set already exists.
)
:: --------- Finish ---------
echo [%DATE% %TIME%] Script completed successfully. >> "%LOG_FILE%"
echo Setup complete. Files are in "%TARGET_DIR%".
pause
exit /b