Added copying config file.

Checks for server's config file is exist and copy it to profile location if not.
This commit is contained in:
2024-12-20 11:30:29 +03:00
parent bb04d7ad1b
commit 312968924a
2 changed files with 13 additions and 3 deletions

View File

@@ -102,7 +102,7 @@ namalskMission=
; [Server-6]
; serverPort=35600
; serverConfig=serverDZ.cfg
; serverConfig=serverDZ-6.cfg
; serverExeName=DayZServer_x64.exe
; serverCPU=2
; startupClientMods=@CF;@VPPAdminTools

View File

@@ -1,4 +1,4 @@
# wDayzManager v0.4
# wDayzManager v0.5
# Copyright (c) 2024 Vladislav Salikov aka W0LF aka 'dreamforce'
# https://github.com/dreamforceinc
# Required module: PSIni
@@ -302,7 +302,17 @@ foreach ($srv in $servers) {
$serverProfile = "$($serverLocation)\$($profilesLocation)\$($instance)"
}
$serverProfile = [System.IO.Path]::GetFullPath($serverProfile)
Write-Host "serverProfile: $($serverProfile)"
# Checks for server's config file is exist and copy it to profile location if not
if (-not (Test-Path -Path "$($serverProfile)\")) {
New-Item -ItemType Directory -Path "$($serverProfile)\" | Out-Null
Copy-Item -Path "$($serverLocation)\serverDZ.cfg" -Destination "$($serverProfile)\$($serverConfig)"
}
else {
if (-not (Test-Path -Path "$($serverProfile)\$($serverConfig)")) {
Copy-Item -Path "$($serverLocation)\serverDZ.cfg" -Destination "$($serverProfile)\$($serverConfig)"
}
}
$startupMods = @("`"-mod=$($startupClientMods)`"", "`"-serverMod=$($startupServerMods)`"")
$startupParams = @("`"-profiles=$($serverProfile)`"", "`"-config=$($serverProfile)\$($serverConfig)`"", "-port=$($serverPort)", "-cpuCount=$($serverCPU)")