Skip to content

Commit 3accdcf

Browse files
authored
Fix cwd not applying on launch (#18801)
1 parent 0b4f966 commit 3accdcf

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/cascadia/TerminalApp/Remoting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace winrt::TerminalApp::implementation
1717
{
1818
CommandlineArgs::CommandlineArgs(winrt::array_view<const winrt::hstring> args, winrt::hstring currentDirectory, uint32_t showWindowCommand, winrt::hstring envString) :
1919
_args{ args.begin(), args.end() },
20-
_cwd{ std::move(currentDirectory) },
20+
CurrentDirectory{ std::move(currentDirectory) },
2121
ShowWindowCommand{ showWindowCommand },
2222
CurrentEnvironment{ std::move(envString) }
2323
{

src/cascadia/TerminalApp/Remoting.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ namespace winrt::TerminalApp::implementation
3636
::TerminalApp::AppCommandlineArgs _parsed;
3737
int32_t _parseResult = 0;
3838
winrt::com_array<winrt::hstring> _args;
39-
winrt::hstring _cwd;
4039
};
4140

4241
struct RequestReceiveContentArgs : RequestReceiveContentArgsT<RequestReceiveContentArgs>

src/cascadia/TerminalApp/TerminalPage.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,11 @@ namespace winrt::TerminalApp::implementation
563563
_WindowProperties.VirtualEnvVars(originalVirtualEnv);
564564
}
565565
});
566-
_WindowProperties.VirtualWorkingDirectory(cwd);
567-
_WindowProperties.VirtualEnvVars(env);
566+
if (!cwd.empty())
567+
{
568+
_WindowProperties.VirtualWorkingDirectory(cwd);
569+
_WindowProperties.VirtualEnvVars(env);
570+
}
568571

569572
for (size_t i = 0; i < actions.size(); ++i)
570573
{

0 commit comments

Comments
 (0)