mirror of
https://github.com/HypoxiE/rimworld-add-my-music-mod.git
synced 2025-12-06 05:45:58 +00:00
Added a script for updating the mod
This commit is contained in:
26
update.ps1
Normal file
26
update.ps1
Normal file
@@ -0,0 +1,26 @@
|
||||
# Указываем ссылки и пути
|
||||
$repoUrl = "https://github.com/HypoxiE/rimworld-add-my-music-mod/archive/refs/heads/main.zip"
|
||||
$zipPath = "$env:TEMP\add_my_music.zip"
|
||||
$extractPath = "$env:TEMP\add_my_music_temp"
|
||||
|
||||
# Скачиваем и распаковываем архив
|
||||
Write-Host "[INFO] Downloading mod from GitHub..."
|
||||
Invoke-WebRequest -Uri $repoUrl -OutFile $zipPath
|
||||
Write-Host "[INFO] Extracting..."
|
||||
Expand-Archive -Path $zipPath -DestinationPath $extractPath -Force
|
||||
|
||||
# список исключений (имена без пути)
|
||||
$keepFolders = @(".git", "Defs", "Sounds")
|
||||
$keepFiles = @()
|
||||
|
||||
Write-Host "[INFO] Uninstall old files..."
|
||||
Get-ChildItem -Path $path -Directory | Where-Object { $keepFolders -notcontains $_.Name } | Remove-Item -Recurse -Force
|
||||
Get-ChildItem -Path $path -File | Where-Object { $keepFiles -notcontains $_.Name } | Remove-Item -Force
|
||||
|
||||
Write-Host "[INFO] Installing new files..."
|
||||
Copy-Item -Path "$extractPath\rimworld-add-my-music-mod-main\*" -Destination "." -Recurse -Force
|
||||
|
||||
# Удаляем временные файлы
|
||||
Write-Host "[INFO] Cleaning up..."
|
||||
Remove-Item $zipPath
|
||||
Remove-Item $extractPath -Recurse -Force
|
||||
Reference in New Issue
Block a user