diff --git a/src/cascadia/TerminalApp/AppLogic.cpp b/src/cascadia/TerminalApp/AppLogic.cpp index 6b5b07bd0..5f16eebd4 100644 --- a/src/cascadia/TerminalApp/AppLogic.cpp +++ b/src/cascadia/TerminalApp/AppLogic.cpp @@ -869,9 +869,6 @@ namespace winrt::TerminalApp::implementation void AppLogic::_RegisterSettingsChange() { const std::filesystem::path settingsPath{ std::wstring_view{ CascadiaSettings::SettingsPath() } }; - const std::filesystem::path statePath{ std::wstring_view{ ApplicationState::SharedInstance().FilePath() } }; - // const std::filesystem::path elevatedStatePath{ std::wstring_view{ ElevatedState::SharedInstance().FilePath() } }; - _reader.create( settingsPath.parent_path().c_str(), false, @@ -880,14 +877,17 @@ namespace winrt::TerminalApp::implementation // editors, who will write a temp file, then rename it to be the // actual file you wrote. So listen for that too. wil::FolderChangeEvents::FileName | wil::FolderChangeEvents::LastWriteTime, - [=](wil::FolderChangeEvent, PCWSTR fileModified) { + [this, settingsPath](wil::FolderChangeEvent, PCWSTR fileModified) { + static const std::filesystem::path statePath{ std::wstring_view{ ApplicationState::SharedInstance().FilePath() } }; + static const std::filesystem::path elevatedStatePath{ std::wstring_view{ ElevatedState::SharedInstance().FilePath() } }; + const auto modifiedBasename = std::filesystem::path{ fileModified }.filename(); if (modifiedBasename == settingsPath.filename()) { _reloadSettings->Run(); } - else if (modifiedBasename == statePath.filename() /*|| modifiedBasename == elevatedStatePath.filename()*/) + else if (modifiedBasename == statePath.filename() || modifiedBasename == elevatedStatePath.filename()) { _reloadState(); } diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index f904d49b6..c905fb308 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -1313,25 +1313,21 @@ namespace winrt::TerminalApp::implementation bool TerminalPage::_shouldPromptForCommandline(const winrt::hstring& cmdline) const { - bool doAdminWarning = true; if (_isElevated()) { - bool commandlineWasAllowed = false; - if (const auto& allowedCommandlines{ ElevatedState::SharedInstance().AllowedCommandlines() }) { for (const auto& approved : allowedCommandlines) { if (approved == cmdline) { - commandlineWasAllowed = true; - break; + return false; } } } - doAdminWarning = !commandlineWasAllowed; } - return doAdminWarning; + + return true; // TODO! Change this to false. This is defaulted to true for testing. } // Method Description: