| 189 | } |
| 190 | |
| 191 | uint64_t GetFileSize(std::string_view path) |
| 192 | { |
| 193 | if (String::startsWith(path, Platform::kAndroidAssetPathPrefix)) |
| 194 | { |
| 195 | auto assetManager = static_cast<AAssetManager*>(GetAssetManager()); |
| 196 | if (assetManager != nullptr) |
| 197 | { |
| 198 | std::string assetPath = std::string(path).substr(Platform::kAndroidAssetPathPrefix.length()); |
| 199 | auto asset = AAssetManager_open(assetManager, assetPath.c_str(), AASSET_MODE_UNKNOWN); |
| 200 | if (asset != nullptr) |
| 201 | { |
| 202 | auto size = AAsset_getLength64(asset); |
| 203 | AAsset_close(asset); |
| 204 | return size; |
| 205 | } |
| 206 | } |
| 207 | return 0; |
| 208 | } |
| 209 | |
| 210 | uint64_t size = 0; |
| 211 | struct stat statInfo{}; |
| 212 | if (stat(std::string(path).c_str(), &statInfo) == 0) |
| 213 | { |
| 214 | size = statInfo.st_size; |
| 215 | } |
| 216 | return size; |
| 217 | } |
| 218 | |
| 219 | #ifndef DISABLE_TTF |
| 220 | std::string GetFontPath(const TTFFontDescriptor& font) |
nothing calls this directly
no test coverage detected