mirror of
https://github.com/microsoft/terminal.git
synced 2026-07-08 18:16:28 +00:00
env: don't explode when GetShortPathNameW fails (#19284)
It fails inside app containers (!) such as the one used by LocalTests.
(cherry picked from commit 91c9a14a71)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgirMsA
Service-Version: 1.23
This commit is contained in:
committed by
Dustin L. Howett
parent
b4cf05a02c
commit
15bc02cb45
@@ -366,12 +366,13 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned"
|
||||
if (til::compare_ordinal_insensitive(var, temp) == 0 ||
|
||||
til::compare_ordinal_insensitive(var, tmp) == 0)
|
||||
{
|
||||
return til::details::wil_env::GetShortPathNameW<std::wstring, 256>(value.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::wstring{ value };
|
||||
std::wstring shortPath;
|
||||
if (SUCCEEDED((til::details::wil_env::GetShortPathNameW<std::wstring, 256>(value.data(), shortPath))))
|
||||
{
|
||||
return shortPath;
|
||||
}
|
||||
}
|
||||
return std::wstring{ value };
|
||||
}
|
||||
|
||||
static bool is_path_var(std::wstring_view input) noexcept
|
||||
|
||||
Reference in New Issue
Block a user