winrt: Add EffectiveLocation support for newer Win10 releases

This commit is contained in:
Ethan Lee 2020-11-09 17:05:21 -05:00
parent 16d789fba9
commit a7d91ebaa5
1 changed files with 6 additions and 1 deletions

View File

@ -48,8 +48,13 @@ SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType)
{ {
static wstring path; static wstring path;
if (path.empty()) { if (path.empty()) {
/* Windows 1903 supports mods, via the EffectiveLocation API */
if (Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8, 0)) {
path = Windows::ApplicationModel::Package::Current->EffectiveLocation->Path->Data();
} else {
path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data(); path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data();
} }
}
return path.c_str(); return path.c_str();
} }