From 312968924a56d323a37c0df39ef779498bcf77a1 Mon Sep 17 00:00:00 2001 From: Vladislav Salikov Date: Fri, 20 Dec 2024 11:30:29 +0300 Subject: [PATCH] Added copying config file. Checks for server's config file is exist and copy it to profile location if not. --- wDayzManager.ini | 2 +- wDayzManager.ps1 | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/wDayzManager.ini b/wDayzManager.ini index 4629c00..5e7272c 100644 --- a/wDayzManager.ini +++ b/wDayzManager.ini @@ -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 diff --git a/wDayzManager.ps1 b/wDayzManager.ps1 index f6f6b85..0f495b7 100644 --- a/wDayzManager.ps1 +++ b/wDayzManager.ps1 @@ -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)")