From df6b522741a369b1cf29ecebef39145a11a3d5f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Fri, 1 Dec 2023 23:44:44 +0100 Subject: [PATCH] Improved postbuild script for ScriptCore: Automatically create target directory --- ScriptCore/postbuild.ps1 | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/ScriptCore/postbuild.ps1 b/ScriptCore/postbuild.ps1 index 8358158..8431562 100644 --- a/ScriptCore/postbuild.ps1 +++ b/ScriptCore/postbuild.ps1 @@ -5,18 +5,20 @@ param [string]$destinationDir ) -# Überprüfe, ob die Verzeichnisse existieren -if ((Test-Path -Path $sourceDir) -and (Test-Path -Path $destinationDir)) +if (-not (Test-Path -Path $sourceDir)) { - - # Gebe die Pfadinformationen aus - Write-Host "Kopiere Dateien von $sourceDir nach $destinationDir" - - # Kopiere alle Dateien vom Quell- zum Zielverzeichnis - Get-ChildItem -Path $sourceDir -File | ForEach-Object { Copy-Item -Path $_.FullName -Destination $destinationDir } - + Write-Host "Source directory $sourceDir doesn't exist." + exit } -else + +# Create destination if necessary +if (-not (Test-Path -Path $destinationDir)) { - Write-Host "Ein oder beide Verzeichnisse existieren nicht." -} \ No newline at end of file + New-Item -ItemType Directory -Force -Path $destinationDir +} + +# Gebe die Pfadinformationen aus +Write-Host "Kopiere Dateien von $sourceDir nach $destinationDir" + +# Copy all files from source folder to the destination folder +Copy-Item -Path "$sourceDir\*" -Destination $destinationDir -Recurse \ No newline at end of file