refactor(windows scripts): remove BOM and improve UTF-8 handling
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<#
|
||||
<#
|
||||
LXS - System Restore Point (Windows)
|
||||
Description: Enable System Protection, create checkpoints, list them and
|
||||
roll back. The safety net for harden.ps1 and debloat.ps1.
|
||||
@@ -20,7 +20,10 @@ if ($LxsLibPath -and (Test-Path $LxsLibPath)) {
|
||||
Write-Error 'Failed to fetch lib/common.ps1'
|
||||
exit 1
|
||||
}
|
||||
. ([scriptblock]::Create($LxsLibSource))
|
||||
# The library ships with a UTF-8 BOM (Windows PowerShell 5.1 needs it to
|
||||
# read the file as UTF-8); over HTTP that BOM arrives as a leading U+FEFF
|
||||
# character, which the parser will not accept.
|
||||
. ([scriptblock]::Create(($LxsLibSource -replace '^\uFEFF', '')))
|
||||
}
|
||||
|
||||
$env:LXS_LOG_FILE = Join-Path (Get-LxsTempDir) 'lxs_restore_point.log'
|
||||
@@ -70,7 +73,7 @@ function Show-LxsProtectionStatus {
|
||||
Write-Host " Shadow storage: $usedGB GB used of $maxGB GB allocated"
|
||||
}
|
||||
} else {
|
||||
Write-LxsWarn "System Protection looks OFF for $drive — no restore points can be created."
|
||||
Write-LxsWarn "System Protection looks OFF for $drive - no restore points can be created."
|
||||
}
|
||||
} catch {
|
||||
Write-LxsWarn 'Could not read the shadow storage configuration.'
|
||||
|
||||
Reference in New Issue
Block a user