android 平台跑通中文路径

This commit is contained in:
xsl
2025-10-28 22:24:24 +08:00
parent 1dfc63543f
commit 13357ab256
20 changed files with 149 additions and 39 deletions
+28
View File
@@ -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)
{