Improved postbuild script for ScriptCore: Automatically create target directory

This commit is contained in:
Simon Lübeß
2023-12-01 23:45:02 +01:00
parent 8f93e1e0e5
commit df6b522741
+12 -10
View File
@@ -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))
{
Write-Host "Source directory $sourceDir doesn't exist."
exit
}
# Create destination if necessary
if (-not (Test-Path -Path $destinationDir))
{
New-Item -ItemType Directory -Force -Path $destinationDir
}
# 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 }
}
else
{
Write-Host "Ein oder beide Verzeichnisse existieren nicht."
}
# Copy all files from source folder to the destination folder
Copy-Item -Path "$sourceDir\*" -Destination $destinationDir -Recurse