mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-23 10:51:58 -05:00
Check if you can create a symlink first
This commit is contained in:
parent
dcbbf2ec78
commit
08b3e803bf
1 changed files with 25 additions and 2 deletions
|
@ -19,6 +19,7 @@ $libsVersion = 7
|
|||
# Get paths
|
||||
$rootPath = Get-RootPath
|
||||
$libsPath = Join-Path $rootPath "lib"
|
||||
$binPath = Join-Path $rootPath "bin"
|
||||
$zipPath = Join-Path $libsPath "openrct2-libs-vs2015.zip"
|
||||
$libsVersionPath = Join-Path $libsPath "libversion"
|
||||
|
||||
|
@ -35,8 +36,30 @@ if ($currentLibsVersion -ge $libsVersion)
|
|||
}
|
||||
|
||||
#symlink data to bin\data
|
||||
Write-Host "Symlink data to bin..." -ForegroundColor Cyan
|
||||
New-Item -force -ItemType SymbolicLink -Name bin\data -Target data
|
||||
try {
|
||||
Write-Host "Symlink data to bin..." -ForegroundColor Cyan
|
||||
New-Item -force -ItemType SymbolicLink -Name bin\data -Target data
|
||||
}
|
||||
catch [System.Management.Automation.ParameterBindingException] {
|
||||
Write-Host "Your powershell can not create symlinks" -ForegroundColor Red
|
||||
Write-Host "Copying data to bin..." -ForegroundColor Cyan
|
||||
New-Item -Force -ItemType Directory $binPath > $null
|
||||
Copy-Item -Force -Recurse "$rootPath\data" $binPath
|
||||
}
|
||||
catch {
|
||||
Write-Host "Symlink not possible" -ForegroundColor Red
|
||||
if($force) {
|
||||
Write-Host "Copying data to bin..." -ForegroundColor Cyan
|
||||
New-Item -Force -ItemType Directory $binPath > $null
|
||||
Copy-Item -Force -Recurse "$rootPath\data" $binPath
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "You need to run powershell in administration mode to symlink the data folder" -ForegroundColor Red
|
||||
Write-Host "Or run the script in force mode to copy the data folder" -ForegroundColor Red
|
||||
throw
|
||||
}
|
||||
}
|
||||
|
||||
# Check if user needs to download dependencies
|
||||
$libsPathExists = Test-Path $libsPath
|
||||
|
|
Loading…
Add table
Reference in a new issue