Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/cascadia/TerminalSettingsModel/VsDevShellGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ void VsDevShellGenerator::GenerateProfiles(const VsSetupConfiguration::VsSetupIn
const winrt::guid profileGuid{ ::Microsoft::Console::Utils::CreateV5Uuid(TERMINAL_PROFILE_NAMESPACE_GUID, std::as_bytes(std::span{ seed })) };
auto profile = winrt::make_self<implementation::Profile>(profileGuid);
profile->Name(winrt::hstring{ GetProfileName(instance) });
profile->Commandline(winrt::hstring{ GetProfileCommandLine(instance) });
bool isPwsh = false;
profile->Commandline(winrt::hstring{ GetProfileCommandLine(instance, isPwsh) });
profile->StartingDirectory(winrt::hstring{ instance.GetInstallationPath() });
profile->Icon(winrt::hstring{ GetProfileIconPath() });
profile->Icon(winrt::hstring{ GetProfileIconPath(isPwsh) });
profile->Hidden(hidden);
profiles.emplace_back(std::move(profile));
}
Expand All @@ -37,7 +38,7 @@ std::wstring VsDevShellGenerator::GetProfileName(const VsSetupConfiguration::VsS
return name;
}

std::wstring VsDevShellGenerator::GetProfileCommandLine(const VsSetupConfiguration::VsSetupInstance& instance) const
std::wstring VsDevShellGenerator::GetProfileCommandLine(const VsSetupConfiguration::VsSetupInstance& instance, bool& isPwsh) const
{
// Build this in stages, so reserve space now
std::wstring commandLine;
Expand All @@ -48,7 +49,8 @@ std::wstring VsDevShellGenerator::GetProfileCommandLine(const VsSetupConfigurati
// We do need to allocate space for the full path even if we don't want to paste the whole thing in
wchar_t pwshPath[MAX_PATH] = { 0 };
const auto pwshExeName = L"pwsh.exe";
if (SearchPathW(nullptr, pwshExeName, nullptr, MAX_PATH, pwshPath, nullptr))
isPwsh = SearchPathW(nullptr, pwshExeName, nullptr, MAX_PATH, pwshPath, nullptr);
if (isPwsh)
{
commandLine.append(pwshExeName);
}
Expand Down
7 changes: 4 additions & 3 deletions src/cascadia/TerminalSettingsModel/VsDevShellGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model
return L"VsDevShell" + instance.GetInstanceId();
}

std::wstring GetProfileIconPath() const
std::wstring GetProfileIconPath(bool isPwsh) const
{
return L"ms-appx:///ProfileIcons/vs-powershell.png";
return isPwsh ? L"ms-appx:///ProfileIcons/vs-pwsh.png" :
L"ms-appx:///ProfileIcons/vs-powershell.png";
}

std::wstring GetProfileName(const VsSetupConfiguration::VsSetupInstance& instance) const;
std::wstring GetProfileCommandLine(const VsSetupConfiguration::VsSetupInstance& instance) const;
std::wstring GetProfileCommandLine(const VsSetupConfiguration::VsSetupInstance& instance, bool& isPwsh) const;
std::wstring GetDevShellModulePath(const VsSetupConfiguration::VsSetupInstance& instance) const;
};
};
Loading