Path validation

This commit is contained in:
almost.m4 2024-07-12 12:57:05 +02:00
parent a25418d3d2
commit 4f4811813c

View File

@ -93,7 +93,7 @@ function Show-LookupXMLEntry {
function Process-ArchiveFile { function Process-ArchiveFile {
if ($ARCHIVE_FILE) { if ($ARCHIVE_FILE) {
if (Test-Path $ARCHIVE_FILE) { if (Test-Path -Path $ARCHIVE_FILE) {
if ($VERBOSE) { Write-Host "File archive exists" } if ($VERBOSE) { Write-Host "File archive exists" }
$PATH_TO_INFOMAP_FILE = 7z l "$ARCHIVE_FILE" | Select-String -Pattern "$INFO_MAP_FILENAME" -NotMatch "LIGHT" | ForEach-Object { $_.Line.Split()[3] } $PATH_TO_INFOMAP_FILE = 7z l "$ARCHIVE_FILE" | Select-String -Pattern "$INFO_MAP_FILENAME" -NotMatch "LIGHT" | ForEach-Object { $_.Line.Split()[3] }
if ($VERBOSE) { if ($VERBOSE) {
@ -121,7 +121,7 @@ function Process-ArchiveFile {
# Verifying presence of Info_Map.imp file on disk # Verifying presence of Info_Map.imp file on disk
if ($VERBOSE) { Write-Host "Verifying presence of Info_Map.imp file on disk" } if ($VERBOSE) { Write-Host "Verifying presence of Info_Map.imp file on disk" }
if (Test-Path "/tmp/$INFO_MAP_FILENAME") { if (Test-Path -Path "/tmp/$INFO_MAP_FILENAME") {
if ($VERBOSE) { Write-Host (ls -l "/tmp/$INFO_MAP_FILENAME") } if ($VERBOSE) { Write-Host (ls -l "/tmp/$INFO_MAP_FILENAME") }
$INFOMAP_FILE = "/tmp/$INFO_MAP_FILENAME" $INFOMAP_FILE = "/tmp/$INFO_MAP_FILENAME"
} else { } else {
@ -157,7 +157,7 @@ function Process-Folder {
) )
if ($VERBOSE) { Write-Host "Processing in folder $MapFolder ..." } if ($VERBOSE) { Write-Host "Processing in folder $MapFolder ..." }
if (Test-Path "./1") { if (Test-Path -Path "./1") {
$MAP_DIR = Get-Location $MAP_DIR = Get-Location
if ($VERBOSE) { Write-Host "We are inside Map folder: $MapFolder ... [OK]" } if ($VERBOSE) { Write-Host "We are inside Map folder: $MapFolder ... [OK]" }