I'm porting a UWP app over to Win32 with WinUI 3.0. In that UWP app I'm loading file resources from the app installation folder as follows:
std::vector<char> MyStorage::ReadFileFromStorageFolder(const std::wstring& relativePath)
{
path filePath = path{ Package::Current().InstalledLocation().Path().data() } / path{ relativePath };
std::ifstream inputFileStream(filePath, std::ios::binary | std::ios::ate);
std::ifstream::pos_type pos = inputFileStream.tellg();
std::vector<char> result(pos);
inputFileStream.seekg(0, std::ios::beg);
inputFileStream.read(&result[0], pos);
return result;
}
Unfortunately, the code Package::Current().InstalledLocation() causes the Win32 WinUI 3.0 app to hang. How would I do this so that it works in the Win32 WinUI 3.0 app?