When we reload a profile, always use the same GUID for it (#2542)

This ensures that settings reload works for profiles w/o GUIDs
This commit is contained in:
Mike Griese 2019-08-26 12:21:30 -05:00 committed by Dustin L. Howett (MSFT)
parent ebcf8126dc
commit cffa033116
2 changed files with 8 additions and 1 deletions

View file

@ -357,7 +357,10 @@ Profile Profile::FromJson(const Json::Value& json)
}
else
{
result._guid = Utils::CreateGuid();
// Always use the name to generate the temporary GUID. That way, across
// reloads, we'll generate the same static GUID.
const std::wstring_view name = result._name;
result._guid = Utils::CreateV5Uuid(RUNTIME_GENERATED_PROFILE_NAMESPACE_GUID, gsl::as_bytes(gsl::make_span(name)));
TraceLoggingWrite(
g_hTerminalAppProvider,

View file

@ -16,6 +16,10 @@ Author(s):
#pragma once
#include "ColorScheme.h"
// GUID used for generating GUIDs at runtime, for profiles that did not have a
// GUID specified manually.
constexpr GUID RUNTIME_GENERATED_PROFILE_NAMESPACE_GUID = { 0xf65ddb7e, 0x706b, 0x4499, { 0x8a, 0x50, 0x40, 0x31, 0x3c, 0xaf, 0x51, 0x0a } };
namespace TerminalApp
{
class Profile;