Server/updateSubmodule.ps1

30 lines
627 B
PowerShell
Raw Permalink Normal View History

param (
[switch]$md = $false
)
Write-Host "Checking for submodule path..."
if (-not(Test-Path Gamelib)) {
Write-Host "Path Gamelib doesn't exist.";
if (-not($md)) {
Write-Host "Exiting.";
Write-Host "If you want to automatically create the subdirectory,";
Write-Host "please pass the flag -md";
exit;
}
New-Item -Path Gamelib -Type Directory;
}
Write-Host "Updating submodule..."
try {
git submodule update --init;
Set-Location Gamelib;
git fetch;
git status;
git checkout gamelib;
git pull;
Set-Location ..;
Write-Host "Update done.";
} catch {
Write-Host "There's been an error. Is Git installed?";
}