feat: refactor file paths to use %LOCALAPPDATA% for user data and logs

This commit is contained in:
Jeffrey
2026-10-16 00:17:26 +02:00
parent 4079b276e9
commit c10c957184
6 changed files with 21 additions and 15 deletions
+2 -7
View File
@@ -4,7 +4,7 @@
.DESCRIPTION
Resolves selected and undo features from the provided keys, captures their
registry state, and saves the result as a JSON file in the Backups/ folder.
registry state, and saves the result under %LOCALAPPDATA%\Win11Debloat\Backups.
Returns the file path on success, $null if no registry-backed features exist.
.PARAMETER ActionableKeys
@@ -28,13 +28,8 @@ function New-RegistrySettingsBackup {
}
$timestamp = Get-Date
$backupDirectory = $script:RegistryBackupsPath
if (-not (Test-Path $backupDirectory)) {
New-Item -ItemType Directory -Path $backupDirectory -Force | Out-Null
}
$backupFileName = 'Win11Debloat-RegistryBackup-{0}.json' -f $timestamp.ToString('yyyyMMdd_HHmmss')
$backupFilePath = Join-Path $backupDirectory $backupFileName
$backupFilePath = Join-Path $script:RegistryBackupsPath $backupFileName
$backupConfig = Get-RegistryBackupPayload -SelectedFeatures $selectedFeatures -UndoFeatures $undoFeatures -CreatedAt $timestamp
if (-not (Save-ToFile -Config $backupConfig -FilePath $backupFilePath -MaxDepth 25)) {
+2
View File
@@ -27,6 +27,8 @@ function Save-ToFile {
)
try {
$directory = Split-Path -Parent $FilePath
if ($directory) { [void][System.IO.Directory]::CreateDirectory($directory) }
$Config | ConvertTo-Json -Depth $MaxDepth | Set-Content -Path $FilePath -Encoding UTF8 -ErrorAction Stop
return $true
}
+1 -1
View File
@@ -98,7 +98,7 @@ function Show-MainWindow {
$menuReportBug.Add_Click({ Start-Process "https://github.com/Raphire/Win11Debloat/issues" })
$menuLogs.Add_Click({
$logsFolder = Join-Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) 'Logs'
$logsFolder = Split-Path -Parent $script:DefaultLogPath
if (Test-Path $logsFolder) {
Start-Process "explorer.exe" -ArgumentList $logsFolder
}