Skip to content

Commit 071ad94

Browse files
author
Bill Sirinek
committed
create a blank patching.json file if it does not exist
1 parent a8ba801 commit 071ad94

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tasks/update_history_windows.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ if ($result_file -eq '') {
1616
$result_file = 'C:\ProgramData\patching\log\patching.json'
1717
}
1818

19+
# if the result file does not exist, create it
20+
if (-not (Test-Path $result_file)) {
21+
New-Item -ItemType "file" -Path (Split-Path -Path $result_file) -Name (Split-Path -Path $result_file -Leaf) | Out-Null
22+
}
23+
1924
$pattern_matches = Select-String -Path $result_file -Pattern "^{$"
2025
if ($pattern_matches) {
2126
# get the LAST matching line number of { , the start of a JSON document

0 commit comments

Comments
 (0)