Skip to content

Commit

Permalink
When we reload a profile, always use the same GUID for it (#2542)
Browse files Browse the repository at this point in the history
This ensures that settings reload works for profiles w/o GUIDs
  • Loading branch information
zadjii-msft authored and DHowett committed Aug 26, 2019
1 parent ebcf812 commit cffa033
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cascadia/TerminalApp/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions src/cascadia/TerminalApp/Profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cffa033

Please sign in to comment.