# Verschiebt die Dateien aus dem Output-Verzeichnis in den resources Ordner

param (
	[string]$outDir,
	[string]$outFile
)

$rootPath = "$PSScriptRoot\.."

$outputPath = "$rootPath\$outDir"

$bridgePath = "$rootPath\..\..\bridge\"

$resourcePath = "$bridgePath\resources\reallife-gamemode"
$runtimePath = "$bridgePath\runtime"

# Pruefen, ob Output-Pfad existiert
if(!(Test-Path $outputPath))
{
	$absoluteOutputPath = Resolve-Path $outputPath
	Write-Host "Output Folder ($absoluteOutputPath) does not exist."
	Exit 0
}

# Pruefen, ob resources-Pfad existiert
#  Wenn NEIN => erstellen
if(!(Test-Path $resourcePath))
{
	Write-Host "Creating 'reallife-gamemode' resources directory"
	New-Item -ItemType Directory -Path $resourcePath | Out-Null
}

# Gamemode und Meta-Datei verschieben
Copy-Item "$outputPath\$outFile" "$resourcePath\" -Force
Copy-Item "$outputPath\meta.xml" "$resourcePath\" -Force

# Abhaengige DLLs in runtime Ordner verschieben
Copy-Item "$outputPath\*.dll" "$runtimePath\" -Exclude "ReallifeGamemode.Server.dll"