diff --git a/.gitignore b/.gitignore index e69de29..e96fab7 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +secrets.ps1 \ No newline at end of file diff --git a/download_mods.ps1 b/download_mods.ps1 index 9bf6355..8401cb0 100644 --- a/download_mods.ps1 +++ b/download_mods.ps1 @@ -2,6 +2,24 @@ $fileId = "13im-l6X2j-s5scZZlBvt2DCjYBbk2qI8" $baseUrl = "https://drive.google.com/uc?export=download&id=$fileId" $outputFile = "$env:TEMP\ruinship_mods.rar" +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition +$rimworldMods = Resolve-Path (Join-Path $scriptDir "..") + +if (-not($rimworldMods -like "*Mods")) { + Write-Host "[Error] Place this program in the Mods folder of the RimWorld game" -ForegroundColor Red + Pause + exit +} + +$ruinship_mod = Join-Path $rimworldMods "\ruinship_mods.rar" + +if (Test-Path $rimworldMods) { + Write-Host "[WARNING] The archive ruinship_mods.rar already exists" -ForegroundColor Yellow + Write-Host "[INFO] Deleting the archive..." + Remove-Item -Recurse -Force $ruinship_mod +} + +Write-Host "[INFO] Sending a request to google disk..." $response = Invoke-WebRequest -Uri $baseUrl -SessionVariable session $form = $response.Forms | Where-Object { $_.Id -eq "download-form" } @@ -27,13 +45,10 @@ else { Write-Host "[INFO] The file was successfully downloaded directly." } -$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition -$rimworldMods = Resolve-Path (Join-Path $scriptDir "..") - $sourceFolder = Get-ChildItem $outputFile | Select-Object -First 1 Copy-Item -Path $sourceFolder.FullName -Destination $rimworldMods Write-Host "[INFO] Cleaning up..." Remove-Item $outputFile -Write-Host "[INFO] The ruinship_mods.rar file has been installed to the path $rimworldMods. Please extract it to install all the necessary mods." -ForegroundColor Green +Write-Host "The ruinship_mods.rar file has been installed to the path $rimworldMods. Please extract it to install all the necessary mods." -ForegroundColor Green diff --git a/setup.bat b/setup.bat index f14feef..9f3d145 100644 --- a/setup.bat +++ b/setup.bat @@ -19,6 +19,10 @@ if "%1"=="-mode" ( call :ScenarioInstall goto end ) + if "%2"=="all" ( + call :installAll + goto end + ) echo Ошибка: Режима %2 не существует goto end )