64489b1ec1
This pull request migrates `profiles.json` to `settings.json` and removes the legacy roaming AppData settings migrator. It also: * separates the key bindings in defaults.json into logical groups * syncs the universal terminal defaults with the primary defaults * removes some stray newlines that ended up at the beginning of settings.json and defaults.json Fixes #5186. Fixes #3291. ### categorize key bindings ### sync universal with main ### kill stray newlines in template files ### move profiles.json to settings.json This commit also changes Get*Settings from returning a string to returning a std::filesystem::path. We gain in expressiveness without a loss in clarity (since path still supports .c_str()). NOTE: I tried to do an atomic rename with the handle open, but it didn't work for reparse points (it moves the destination of a symbolic link out into the settings folder directly.) (snip for atomic rename code) ```c++ auto path{ pathToSettingsFile.wstring() }; auto renameBufferSize{ sizeof(FILE_RENAME_INFO) + (path.size() * sizeof(wchar_t)) }; auto renameBuffer{ std::make_unique<std::byte[]>(renameBufferSize) }; auto renameInfo{ reinterpret_cast<FILE_RENAME_INFO*>(renameBuffer.get()) }; renameInfo->Flags = FILE_RENAME_FLAG_REPLACE_IF_EXISTS | FILE_RENAME_FLAG_POSIX_SEMANTICS; renameInfo->RootDirectory = nullptr; renameInfo->FileNameLength = gsl::narrow_cast<DWORD>(path.size()); std::copy(path.cbegin(), path.cend(), std::begin(renameInfo->FileName)); THROW_IF_WIN32_BOOL_FALSE(SetFileInformationByHandle(hLegacyFile.get(), FileRenameInfo, renameBuffer.get(), gsl::narrow_cast<DWORD>(renameBufferSize))); ``` (end snip) ### Stop resurrecting dead roaming profiles
29 lines
1.3 KiB
PowerShell
29 lines
1.3 KiB
PowerShell
# This script is used for taking a json file and stamping it into a header with
|
|
# the contents of that json files as a constexpr string_view in the header.
|
|
|
|
param (
|
|
[parameter(Mandatory=$true, Position=0)]
|
|
[string]$JsonFile,
|
|
|
|
[parameter(Mandatory=$true, Position=1)]
|
|
[string]$OutPath,
|
|
|
|
[parameter(Mandatory=$true, Position=2)]
|
|
[string]$VariableName
|
|
)
|
|
|
|
# Load the xml files.
|
|
$jsonData = Get-Content $JsonFile
|
|
|
|
Write-Output "// Copyright (c) Microsoft Corporation" | Out-File -FilePath $OutPath -Encoding ASCII
|
|
Write-Output "// Licensed under the MIT license." | Out-File -FilePath $OutPath -Encoding ASCII -Append
|
|
Write-Output "" | Out-File -FilePath $OutPath -Encoding ASCII -Append
|
|
Write-Output "// THIS IS AN AUTO-GENERATED FILE" | Out-File -FilePath $OutPath -Encoding ASCII -Append
|
|
Write-Output "// Generated from " | Out-File -FilePath $OutPath -Encoding ASCII -Append -NoNewline
|
|
$fullPath = Resolve-Path -Path $JsonFile
|
|
Write-Output $fullPath.Path | Out-File -FilePath $OutPath -Encoding ASCII -Append
|
|
Write-Output "constexpr std::string_view $($VariableName){ R`"(" | Out-File -FilePath $OutPath -Encoding ASCII -Append -NoNewline
|
|
Write-Output $jsonData | Out-File -FilePath $OutPath -Encoding ASCII -Append
|
|
Write-Output ")`" };" | Out-File -FilePath $OutPath -Encoding ASCII -Append
|
|
|