Files
ARCG-Remote-Station-Software/tools/check-windows-paths.ps1
OE6DXD e1a4ce0b8b initialize generic rms-software repository
Add the reusable RMS core application (server, web UI, plugins, tests, tools) with generic defaults, GPL licensing, and maintainer context documentation so deployments can consume this repo as software source independent of station-specific overlays.
2026-03-16 03:31:08 +01:00

54 lines
1.1 KiB
PowerShell

$ErrorActionPreference = "Stop"
param(
[Parameter(Mandatory = $false)]
[string]$RepoPath = "."
)
$invalidCharPattern = '[<>:""/|?*]'
$reserved = '^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\..*)?$'
$repoAbs = Resolve-Path $RepoPath
Push-Location $repoAbs
try {
$paths = git ls-tree -r --name-only HEAD
if (-not $paths) {
Write-Output "Keine Dateien im Git-Tree gefunden."
exit 0
}
$issues = @()
foreach ($p in $paths) {
$parts = $p -split '/'
foreach ($part in $parts) {
if ($part -match $invalidCharPattern) {
$issues += "INVALID_CHAR: $p"
break
}
if ($part -match $reserved) {
$issues += "RESERVED_NAME: $p"
break
}
if ($part.EndsWith(".") -or $part.EndsWith(" ")) {
$issues += "TRAILING_DOT_SPACE: $p"
break
}
}
if ($p.Length -gt 245) {
$issues += "POTENTIAL_LONG_PATH($($p.Length)): $p"
}
}
if ($issues.Count -eq 0) {
Write-Output "Keine offensichtlichen Windows-Pfadprobleme im aktuellen Commit gefunden."
exit 0
}
$issues | Sort-Object -Unique | ForEach-Object { Write-Output $_ }
exit 2
}
finally {
Pop-Location
}