Fix VS generator not producing a source
This commit is contained in:
parent
8f669c60d0
commit
9c59a20ea6
|
@ -29,7 +29,7 @@ void AzureCloudShellGenerator::GenerateProfiles(std::vector<winrt::com_ptr<imple
|
|||
{
|
||||
if (AzureConnection::IsAzureConnectionAvailable())
|
||||
{
|
||||
auto azureCloudShellProfile{ CreateDynamicProfile(AzureGeneratorNamespace, L"Azure Cloud Shell") };
|
||||
auto azureCloudShellProfile{ CreateDynamicProfile(L"Azure Cloud Shell") };
|
||||
azureCloudShellProfile->StartingDirectory(winrt::hstring{ DEFAULT_STARTING_DIRECTORY });
|
||||
azureCloudShellProfile->DefaultAppearance().ColorSchemeName(L"Vintage");
|
||||
azureCloudShellProfile->ConnectionType(AzureConnection::ConnectionType());
|
||||
|
|
|
@ -25,7 +25,6 @@ void BaseVisualStudioGenerator::GenerateProfiles(std::vector<winrt::com_ptr<impl
|
|||
const auto seed = GetProfileGuidSeed(instance);
|
||||
const winrt::guid profileGuid{ ::Microsoft::Console::Utils::CreateV5Uuid(TERMINAL_PROFILE_NAMESPACE_GUID, gsl::as_bytes(gsl::make_span(seed))) };
|
||||
auto profile = winrt::make_self<implementation::Profile>(profileGuid);
|
||||
profile->Origin(OriginTag::Generated);
|
||||
profile->Name(winrt::hstring{ GetProfileName(instance) });
|
||||
profile->Commandline(winrt::hstring{ GetProfileCommandLine(instance) });
|
||||
profile->StartingDirectory(winrt::hstring{ instance.GetInstallationPath() });
|
||||
|
|
|
@ -129,14 +129,30 @@ void SettingsLoader::GenerateProfiles()
|
|||
{
|
||||
const auto executeGenerator = [&](const auto& generator) {
|
||||
const auto generatorNamespace = generator.GetNamespace();
|
||||
|
||||
if (!_ignoredNamespaces.count(generatorNamespace))
|
||||
if (_ignoredNamespaces.count(generatorNamespace))
|
||||
{
|
||||
try
|
||||
return;
|
||||
}
|
||||
|
||||
const auto previousSize = inboxSettings.profiles.size();
|
||||
|
||||
try
|
||||
{
|
||||
generator.GenerateProfiles(inboxSettings.profiles);
|
||||
}
|
||||
CATCH_LOG_MSG("Dynamic Profile Namespace: \"%.*s\"", gsl::narrow<int>(generatorNamespace.size()), generatorNamespace.data())
|
||||
|
||||
// If the generator produced some profiles we're going to give them default attributes.
|
||||
// By settings the Origin/Source/... here, we deduplicate some code and ensure they aren't accidentally missing.
|
||||
if (inboxSettings.profiles.size() > previousSize)
|
||||
{
|
||||
const winrt::hstring source{ generatorNamespace };
|
||||
|
||||
for (const auto& profile : gsl::span(inboxSettings.profiles).subspan(previousSize))
|
||||
{
|
||||
generator.GenerateProfiles(inboxSettings.profiles);
|
||||
profile->Origin(OriginTag::Generated);
|
||||
profile->Source(source);
|
||||
}
|
||||
CATCH_LOG_MSG("Dynamic Profile Namespace: \"%.*s\"", gsl::narrow<int>(generatorNamespace.size()), generatorNamespace.data())
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -15,21 +15,16 @@ static constexpr std::wstring_view PACKAGED_PROFILE_ICON_EXTENSION{ L".png" };
|
|||
// - name: the name of the new profile.
|
||||
// Return Value:
|
||||
// - A Profile, ready to be filled in
|
||||
winrt::com_ptr<winrt::Microsoft::Terminal::Settings::Model::implementation::Profile> CreateDynamicProfile(const std::wstring_view& source, const std::wstring_view& name)
|
||||
winrt::com_ptr<winrt::Microsoft::Terminal::Settings::Model::implementation::Profile> CreateDynamicProfile(const std::wstring_view& name)
|
||||
{
|
||||
const winrt::guid profileGuid{ Microsoft::Console::Utils::CreateV5Uuid(TERMINAL_PROFILE_NAMESPACE_GUID,
|
||||
gsl::as_bytes(gsl::make_span(name))) };
|
||||
|
||||
auto newProfile = winrt::make_self<winrt::Microsoft::Terminal::Settings::Model::implementation::Profile>(profileGuid);
|
||||
newProfile->Source(winrt::hstring{ source });
|
||||
newProfile->Name(winrt::hstring{ name });
|
||||
const auto profileGuid = Microsoft::Console::Utils::CreateV5Uuid(TERMINAL_PROFILE_NAMESPACE_GUID, gsl::as_bytes(gsl::make_span(name)));
|
||||
|
||||
std::wstring iconPath{ PACKAGED_PROFILE_ICON_PATH };
|
||||
iconPath.append(Microsoft::Console::Utils::GuidToString(profileGuid));
|
||||
iconPath.append(PACKAGED_PROFILE_ICON_EXTENSION);
|
||||
|
||||
newProfile->Icon(winrt::hstring{ iconPath });
|
||||
newProfile->Origin(winrt::Microsoft::Terminal::Settings::Model::OriginTag::Generated);
|
||||
|
||||
return newProfile;
|
||||
auto profile = winrt::make_self<winrt::Microsoft::Terminal::Settings::Model::implementation::Profile>(profileGuid);
|
||||
profile->Name(winrt::hstring{ name });
|
||||
profile->Icon(winrt::hstring{ iconPath });
|
||||
return profile;
|
||||
}
|
||||
|
|
|
@ -23,4 +23,4 @@ Author(s):
|
|||
// uuidv5 properties: name format is UTF-16LE bytes
|
||||
static constexpr GUID TERMINAL_PROFILE_NAMESPACE_GUID = { 0x2bde4a90, 0xd05f, 0x401c, { 0x94, 0x92, 0xe4, 0x8, 0x84, 0xea, 0xd1, 0xd8 } };
|
||||
|
||||
winrt::com_ptr<winrt::Microsoft::Terminal::Settings::Model::implementation::Profile> CreateDynamicProfile(const std::wstring_view& source, const std::wstring_view& name);
|
||||
winrt::com_ptr<winrt::Microsoft::Terminal::Settings::Model::implementation::Profile> CreateDynamicProfile(const std::wstring_view& name);
|
||||
|
|
|
@ -308,7 +308,7 @@ void PowershellCoreProfileGenerator::GenerateProfiles(std::vector<winrt::com_ptr
|
|||
for (const auto& psI : psInstances)
|
||||
{
|
||||
const auto name = psI.Name();
|
||||
auto profile{ CreateDynamicProfile(PowershellCoreGeneratorNamespace, name) };
|
||||
auto profile{ CreateDynamicProfile(name) };
|
||||
profile->Commandline(winrt::hstring{ psI.executablePath.native() });
|
||||
profile->StartingDirectory(winrt::hstring{ DEFAULT_STARTING_DIRECTORY });
|
||||
profile->DefaultAppearance().ColorSchemeName(L"Campbell");
|
||||
|
|
|
@ -36,7 +36,7 @@ std::wstring_view WslDistroGenerator::GetNamespace() const noexcept
|
|||
|
||||
static winrt::com_ptr<implementation::Profile> makeProfile(const std::wstring& distName)
|
||||
{
|
||||
const auto WSLDistro{ CreateDynamicProfile(WslGeneratorNamespace, distName) };
|
||||
const auto WSLDistro{ CreateDynamicProfile(distName) };
|
||||
WSLDistro->Commandline(winrt::hstring{ L"wsl.exe -d " + distName });
|
||||
WSLDistro->DefaultAppearance().ColorSchemeName(L"Campbell");
|
||||
WSLDistro->StartingDirectory(winrt::hstring{ DEFAULT_STARTING_DIRECTORY });
|
||||
|
|
Loading…
Reference in a new issue