-
Notifications
You must be signed in to change notification settings - Fork 18
/
removeLocalBuild.ps1
55 lines (48 loc) · 4.06 KB
/
removeLocalBuild.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
$propertiesExist = Test-Path localDevDeploy.properties
$ErrorActionPreference = "Stop"
if ($propertiesExist -eq $true) {
Write-Host ""
Write-Host "Reading localDevDeploy.properties"
Write-Host ""
# Build the settings we will work with
$properties = Get-Content localDevDeploy.properties
$settings = @{""=""};
foreach ($line in $properties) {
$items = $line.Split("=")
$settings.Add($items[0], $items[1])
}
# Ensure we know what things to operate on
if($settings.ContainsKey("arma3Install") -eq $true -and $settings.ContainsKey("pboManagerInstall") -eq $true) {
# Set the dev file name that we'll be using everywhere
$devFileName = "DUWS-R_dev.Altis.pbo"
# Pull other 'real' release out by renaming them to .bak
$tmp = $settings["arma3Install"] + "\Missions\"
$oldExists = Test-Path "$tmp$devFileName"
if($oldExists -eq $true) {
Remove-Item "$tmp$devFileName"
}
$otherFiles = Get-ChildItem $tmp -filter "DUWS-R_*.pbo.bak"
foreach ($file in $otherFiles){
$lenOfName = $("$tmp$file").length
Rename-Item "$tmp$file" $("$tmp$file").substring(0, $lenOfName-3)
}
# Pull other 'real' release out by renaming them to .bak
$tmp = $settings["arma3Install"] + "\MPMissions\"
$oldExists = Test-Path "$tmp$devFileName"
if($oldExists -eq $true) {
Remove-Item "$tmp$devFileName"
}
$otherFiles = Get-ChildItem $tmp -filter "DUWS-R_*.pbo.bak"
foreach ($file in $otherFiles){
$lenOfName = $("$tmp$file").length
Rename-Item "$tmp$file" $("$tmp$file").substring(0, $lenOfName-3)
}
} else {
Write-Host "could not find arma3Install and pboManagerInstall keys in properties file"
}
Write-Host ""
} else {
Write-Host ""
Write-Host "Cannot find localDevDeploy.properties. Please create and configure the file then try again."
Write-Host ""
}