filesystem.cpp: Avoid loading GetTempPath2W for OneCore
#5565
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
GetModuleHandleWis a "desktop apps only" API. We avoid calling it for OneCore:STL/stl/src/winapisupp.cpp
Lines 179 to 194 in 7841cf8
and so we can't load
GetTempPath2Wfor OneCore and must always use theGetTempPathWfallback instead:STL/stl/src/winapisupp.cpp
Lines 164 to 175 in 7841cf8
winapisupp.cppis built into the STL's DLL, and the non-dllexported__crtGetTempPath2Wis used byfilesys.cppin the DLL, implementing the non-Standard/highly-deprecated<experimental/filesystem>.For Standard
<filesystem>, we injectfilesystem.cppinto the STL's import LIB, but we weren't similarly guardingGetModuleHandleW. (This is the only other call in the STL.) Somehow, nobody has hissed about<filesystem>being incompatible with UWP apps, but I suspect maybe nobody happened to be callingtemp_directory_path()in their UWP apps, and so the linker discarded this unused machinery from the import lib. In any event, we should fix the code to be consistent and avoid potential problems for UWP.