Skip to content

Commit

Permalink
smarter pragma
Browse files Browse the repository at this point in the history
  • Loading branch information
steve02081504 committed Aug 5, 2024
1 parent d7704be commit bff16e1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ReadScriptFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function Preprocessor($Content, $FilePath) {
$Params["no$pragmaname"] = [Switch]-not $value
}
}
elseif ($ParamList[$pragmaname].ParameterType -eq [string]) {
elseif ($ParamList[$pragmaname].ParameterType -eq [string] -or $ParamList[$pragmaname+"File"].ParameterType -eq [string]) {
if ($value -match '^\"(?<value>[^\"]*)\"\s*(?!#.*)') {
$value = $Matches["value"].Replace('$PSScriptRoot', $ScriptRoot)
}
Expand All @@ -149,7 +149,12 @@ function Preprocessor($Content, $FilePath) {
else {
$value = $value.Replace('$PSScriptRoot', $ScriptRoot)
}
$Params[$pragmaname] = $value
if ($ParamList[$pragmaname].ParameterType -eq [string]) {
$Params[$pragmaname] = $value
}
elseif ($ParamList[$pragmaname+"File"].ParameterType -eq [string]) {
$Params[$pragmaname+"File"] = $value
}
}
elseif ($ParamList[$pragmaname].ParameterType) {
Write-I18n Warning UnknownPragmaBadParameterType $($pragmaname, $ParamList[$pragmaname].ParameterType)
Expand Down

0 comments on commit bff16e1

Please # to comment.