Skip to content

Commit

Permalink
Search for program file inside of program directory in case of multip…
Browse files Browse the repository at this point in the history
…le directories. See #6.
  • Loading branch information
tmatijevich committed Dec 28, 2022
1 parent d3bb47b commit dbd1b7e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions BuildVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,17 @@ if(-not [System.IO.Directory]::Exists($LogicalPath)) {
else { exit 0 }
}
$SearchProgram = Get-ChildItem -Path $LogicalPath -Filter $ProgramName -Recurse -Directory -Name
if($SearchProgram.Length -ne 0) {
$ProgramPath = $LogicalPath + $SearchProgram + "\"
Write-Host "BuildVersion: Located $ProgramName program at $ProgramPath"
$LocalVariableFile = $ProgramPath + "Variables.var"
$ProgramFound = $False
for($i = 0; $i -lt $SearchProgram.Length; $i++) {
$ProgramPath = $LogicalPath + $SearchProgram[$i] + "\"
if([System.IO.File]::Exists($ProgramPath + "ANSIC.prg")) {
$ProgramFound = $True
Write-Host "BuildVersion: Located $ProgramName program at $ProgramPath"
$LocalVariableFile = $ProgramPath + "Variables.var"
break
}
}
else {
if(-NOT $ProgramFound) {
Write-Host "BuildVersion: Unable to locate $ProgramName in $LogicalPath"
$ProgramPath = "BadPath"
$LocalVariableFile = "BadPath"
Expand Down

0 comments on commit dbd1b7e

Please sign in to comment.