diff --git a/.gitignore b/.gitignore index e96fab7..4036ad1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -secrets.ps1 \ No newline at end of file +secrets.ps1 +archive/ +get_archive.bat \ No newline at end of file diff --git a/install_scenario.ps1 b/install_scenario.ps1 index 607d1b5..a4fd24e 100644 --- a/install_scenario.ps1 +++ b/install_scenario.ps1 @@ -2,11 +2,11 @@ $fileId = "1eEBGmfh7Gu2g_KQoCiVg8XsRM9m_-DZB" $baseUrl = "https://drive.google.com/uc?export=download&id=$fileId" $rimworldPath = Join-Path $env:USERPROFILE "AppData\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios" -$rimworldConfigPath = Join-Path $rimworldPath "Scenarios\RuinShip.rsc" +$rimworldScenarioPath = Join-Path $rimworldPath "Scenarios\RuinShip.rsc" $response = Invoke-WebRequest -Uri $baseUrl -SessionVariable session Write-Host "[INFO] Downloading scenario..." -Invoke-WebRequest -Uri $baseUrl -OutFile $rimworldConfigPath +Invoke-WebRequest -Uri $baseUrl -OutFile $rimworldScenarioPath Write-Host "[INFO] RuinShip.rsc was successfully downloaded." -ForegroundColor Green \ No newline at end of file diff --git a/paths_checker.ps1 b/paths_checker.ps1 new file mode 100644 index 0000000..6506147 --- /dev/null +++ b/paths_checker.ps1 @@ -0,0 +1,23 @@ +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition +$rimworldMods = Resolve-Path (Join-Path $scriptDir "..") + +$rimworldPath = Join-Path $env:USERPROFILE "AppData\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios" +$rimworldScenarioPath = Join-Path $rimworldPath "Scenarios" +$rimworldConfigPath = Join-Path $rimworldPath "Config" + +Write-Host "[INFO] Checking game dirs..." +if (-not(Test-Path $rimworldPath)) { + exit 1 +} + +Write-Host "[INFO] Checking scenario dir..." +if (-not(Test-Path $rimworldScenarioPath)) { + exit 2 +} + +Write-Host "[INFO] Checking config dir..." +if (-not(Test-Path $rimworldConfigPath)) { + exit 3 +} + +exit 0 \ No newline at end of file diff --git a/setup.bat b/setup.bat index 785d7cf..c0dc8c2 100644 --- a/setup.bat +++ b/setup.bat @@ -2,6 +2,23 @@ setlocal enabledelayedexpansion chcp 65001 +powershell -ExecutionPolicy Bypass -File "%~dp0paths_checker.ps1" +if %ERRORLEVEL%==1 ( + echo Ошибка: директория "%%userprofile%%\AppData\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios" не найдена + pause + goto end +) +if %ERRORLEVEL%==2 ( + echo Ошибка: директория "%%userprofile%%\AppData\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios\Scenarios" не найдена + pause + goto end +) +if %ERRORLEVEL%==3 ( + echo Ошибка: директория "%%userprofile%%\AppData\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios\Config" не найдена + pause + goto end +) + if "%1"=="-mode" ( if "%2"=="" ( echo Ошибка: Аргумент не передан