Skip to content

Commit

Permalink
Collect all known PowerShell Core installations for dynamic profiles (#…
Browse files Browse the repository at this point in the history
…4273)

This pull request teaches the PowerShell Core generator about a bunch of different locations in which it might find a PowerShell.

These instances will be sorted, a leader will be elected, and that leader will be promoted and given the vaunted title of "PowerShell".

Names will be generated for the rest.

The sort order is documented in the comments, but that comment will be replicated here:

```
// <-- Less Valued .................................... More Valued -->
// |                 All instances of PS 6                 | All PS7  |
// |          Preview          |          Stable           | ~~~      |
// |  Non-Native | Native      |  Non-Native | Native      | ~~~      |
// | Trd  | Pack | Trd  | Pack | Trd  | Pack | Trd  | Pack | ~~~      |
// (where Pack is a stand-in for store, scoop, dotnet, though they have their own orders,
// and Trd is a stand-in for "Traditional" (Program Files))
```

Closes #2300
  • Loading branch information
DHowett committed Jan 31, 2020
1 parent 06e9605 commit bba0527
Show file tree
Hide file tree
Showing 11 changed files with 291 additions and 55 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
341 changes: 290 additions & 51 deletions src/cascadia/TerminalApp/PowershellCoreProfileGenerator.cpp

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions src/cascadia/TerminalApp/PowershellCoreProfileGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,5 @@ namespace TerminalApp
std::wstring_view GetNamespace() override;

std::vector<TerminalApp::Profile> GenerateProfiles() override;

private:
static bool _isPowerShellCoreInstalled(std::filesystem::path& cmdline);
static bool _isPowerShellCoreInstalledInPath(const std::wstring_view programFileEnv, std::filesystem::path& cmdline);
};
};
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/Profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class TerminalApp::Profile final
bool HasConnectionType() const noexcept;
GUID GetConnectionType() const noexcept;

void SetGuid(GUID guid) noexcept { _guid = guid; }
void SetFontFace(std::wstring fontFace) noexcept;
void SetColorScheme(std::optional<std::wstring> schemeName) noexcept;
std::optional<std::wstring>& GetSchemeName() noexcept;
Expand Down

0 comments on commit bba0527

Please sign in to comment.