Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
SirGamers authored Jul 24, 2023
1 parent 651591c commit d3b13e0
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions tps.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
function Get-DirectoryPath {
param (
[string]$promptMessage = "Press enter if your Borderlands Pre-Sequel folder is stored at C:\Program Files (x86)\Steam\steamapps\common\BorderlandsPreSequel, otherwise type in the path to TPS and press enter",
[string]$defaultPath = "C:\Program Files (x86)\Steam\steamapps\common\BorderlandsPreSequel"
)

# Prompt the user for input
$userInput = Read-Host -Prompt $promptMessage

# If no input provided, use the default path
if ([string]::IsNullOrEmpty($userInput)) {
$userInput = $defaultPath
}

# Check if the directory path exists, otherwise keep prompting
while (-not (Test-Path -Path $userInput -PathType Container)) {
Write-Host "The directory does not exist. Please try again."
$userInput = Read-Host -Prompt $promptMessage

if ([string]::IsNullOrEmpty($userInput)) {
$userInput = $defaultPath
}
}

# add /Binaries to the path
$additionalDirectory = "Binaries"
$selectedPath = Join-Path -Path $userInput -ChildPath $additionalDirectory

return $selectedPath
}

# Call the function to get the directory path from the user and add "/Binaries" to the path
$selectedPath = Get-DirectoryPath

# download and extract pythonsdk
Invoke-WebRequest -uri "https://github.com/SirGamers/bl2automod/raw/main/a.zip" -OutFile $selectedPath\a.zip
Expand-Archive $selectedPath\a.zip -DestinationPath $selectedPath\Win32

# download some mods that are basically needed
Invoke-WebRequest -uri "https://github.com/apple1417/bl-sdk-mods/raw/master/TextModLoader/TextModLoader.zip" -OutFile $selectedPath\b.zip
Expand-Archive $selectedPath\b.zip -DestinationPath $selectedPath\Win32\mods
Invoke-WebRequest -uri "https://github.com/apple1417/bl-sdk-mods/raw/master/NoAds/NoAds.zip" -OutFile $selectedPath\c.zip
Expand-Archive $selectedPath\c.zip -DestinationPath $selectedPath\Win32\mods

# function to remove the zips afterwards
function Remove-FilesInSelectedPath {
param (
[string]$selectedPath
)

# Define the list of file names to be removed
$fileNamesToRemove = @("a.zip", "b.zip", "c.zip")

# Loop through the list and remove each file
foreach ($fileName in $fileNamesToRemove) {
$filePath = Join-Path -Path $selectedPath -ChildPath $fileName

if (Test-Path $filePath) {
Remove-Item $filePath -Force
Write-Host "Removed file: $filePath"
} else {
Write-Host "File not found: $filePath"
}
}
}

# call the function
Remove-FilesInSelectedPath -selectedPath $selectedPath

0 comments on commit d3b13e0

Please sign in to comment.