android 平台跑通中文路径
This commit is contained in:
@@ -21,6 +21,34 @@ void VK_CHECK(VkResult ret)
|
||||
//#endif
|
||||
// return path;
|
||||
//}
|
||||
#ifdef _WIN32
|
||||
std::vector<unsigned char> AppBase::readFileUnsignedCharWin32(const std::wstring path, bool example)
|
||||
{
|
||||
std::vector<unsigned char> buffer;
|
||||
|
||||
std::wstring enginePath = L"app/src/main/assets/" + path;
|
||||
if (example)
|
||||
{
|
||||
enginePath = L"example/src/main/assets/" + path;
|
||||
}
|
||||
std::ifstream file{ enginePath, std::ios::ate | std::ios::binary };
|
||||
|
||||
if (!file.is_open())
|
||||
{
|
||||
throw std::runtime_error("failed to open file: ");
|
||||
}
|
||||
|
||||
size_t fileSize = static_cast<size_t>(file.tellg());
|
||||
buffer.resize(fileSize);
|
||||
|
||||
file.seekg(0);
|
||||
file.read((char*)buffer.data(), fileSize);
|
||||
file.close();
|
||||
|
||||
|
||||
return buffer;
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
std::vector<unsigned char> AppBase::readFileUnsignedChar(const std::string& path, bool example)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user