Fix cwd not applying on launch (#18801)

This commit is contained in:
Leonard Hecker 2025-04-15 22:22:09 +02:00 committed by GitHub
parent 0b4f9662c7
commit 3accdcfc6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 4 deletions

View File

@ -17,7 +17,7 @@ namespace winrt::TerminalApp::implementation
{ {
CommandlineArgs::CommandlineArgs(winrt::array_view<const winrt::hstring> args, winrt::hstring currentDirectory, uint32_t showWindowCommand, winrt::hstring envString) : CommandlineArgs::CommandlineArgs(winrt::array_view<const winrt::hstring> args, winrt::hstring currentDirectory, uint32_t showWindowCommand, winrt::hstring envString) :
_args{ args.begin(), args.end() }, _args{ args.begin(), args.end() },
_cwd{ std::move(currentDirectory) }, CurrentDirectory{ std::move(currentDirectory) },
ShowWindowCommand{ showWindowCommand }, ShowWindowCommand{ showWindowCommand },
CurrentEnvironment{ std::move(envString) } CurrentEnvironment{ std::move(envString) }
{ {

View File

@ -36,7 +36,6 @@ namespace winrt::TerminalApp::implementation
::TerminalApp::AppCommandlineArgs _parsed; ::TerminalApp::AppCommandlineArgs _parsed;
int32_t _parseResult = 0; int32_t _parseResult = 0;
winrt::com_array<winrt::hstring> _args; winrt::com_array<winrt::hstring> _args;
winrt::hstring _cwd;
}; };
struct RequestReceiveContentArgs : RequestReceiveContentArgsT<RequestReceiveContentArgs> struct RequestReceiveContentArgs : RequestReceiveContentArgsT<RequestReceiveContentArgs>

View File

@ -563,8 +563,11 @@ namespace winrt::TerminalApp::implementation
_WindowProperties.VirtualEnvVars(originalVirtualEnv); _WindowProperties.VirtualEnvVars(originalVirtualEnv);
} }
}); });
_WindowProperties.VirtualWorkingDirectory(cwd); if (!cwd.empty())
_WindowProperties.VirtualEnvVars(env); {
_WindowProperties.VirtualWorkingDirectory(cwd);
_WindowProperties.VirtualEnvVars(env);
}
for (size_t i = 0; i < actions.size(); ++i) for (size_t i = 0; i < actions.size(); ++i)
{ {