diff --git a/Compile.ps1 b/Compile.ps1 index f28c5933..72e32c0b 100644 --- a/Compile.ps1 +++ b/Compile.ps1 @@ -9,7 +9,7 @@ $workingdir = $PSScriptRoot # Variable to sync between runspaces $sync = [Hashtable]::Synchronized(@{}) -$sync.PSScriptRoot = $PSScriptRoot +$sync.PSScriptRoot = $workingdir $sync.configs = @{} function Update-Progress { diff --git a/tools/Do-PreProcessing.ps1 b/tools/Do-PreProcessing.ps1 index cd29f506..f634fb26 100644 --- a/tools/Do-PreProcessing.ps1 +++ b/tools/Do-PreProcessing.ps1 @@ -7,9 +7,11 @@ function Do-PreProcessing { [string]$ProgressActivity = "Pre-Processing" ) - $excludedFiles = @('git\', '.gitignore', '.gitattributes', '.github\CODEOWNERS', 'LICENSE', 'winutil.ps1', 'docs\changelog.md', '*.png', '*.jpg', '*.jpeg', '*.exe') + # We could do Pre-processing on this script file, but by excluding it.. we could possible weird behavior, + # like future runs of this tool being different then previous ones, as the script has modified it self before one or more times. + $excludedFiles = @('git\', '.gitignore', '.gitattributes', '.github\CODEOWNERS', 'LICENSE', 'winutil.ps1', 'tools\Do-PreProcessing.ps1', 'docs\changelog.md', '*.png', '*.jpg', '*.jpeg', '*.exe') - $files = Get-ChildItem $workingdir -Recurse -Exclude $excludedFiles -Attributes !Directory + $files = Get-ChildItem $sync.PSScriptRoot -Recurse -Exclude $excludedFiles -Attributes !Directory $numOfFiles = $files.Count for ($i = 0; $i -lt $numOfFiles; $i++) { @@ -24,7 +26,7 @@ function Do-PreProcessing { -replace ('try\{', 'try {') ` -replace ('try\r?\n\s*\{', 'try {') ` -replace ('}\r?\n\s*catch', '} catch') ` - -replace ('\} catch', '} catch') ` + -replace ('\} Catch', '} catch') ` | Set-Content "$file" Write-Progress -Activity $ProgressActivity -Status "$ProgressStatusMessage - Finished $i out of $numOfFiles" -PercentComplete (($i/$numOfFiles)*100) }